dokuwiki-plugin-bureaucracy icon indicating copy to clipboard operation
dokuwiki-plugin-bureaucracy copied to clipboard

Generate select elements from a page or a search

Open tomio13 opened this issue 8 years ago • 10 comments

I think, we could add an alternative select field, like selectfrom or selectlist that uses a file to generate the elements of the list or uses the pages returned by search for the same purpose. This I am to use in a stock description system, where people can link to existing pages dynamically within forms. This is a potential solution fo Issue #157. An example solution is attached. These are two altered select fields one can put into the helper folder of bureaucracy. I guess it would be an interesting feature.

selectfrom-list.zip

tomio13 avatar Dec 10 '16 20:12 tomio13

as I'm not good in reading php sourcecode, can you please add two lines of documentation on how to use these two helpers ?

May be syntax examples ?

roadrunnerjb avatar Aug 23 '18 09:08 roadrunnerjb

Hi, it has been ages that I posted this with none being itnterested. This code added some new fields and a new action part to the plugin.

The selectfrom was something like: let us have a page :home:list You want a form with a selector containing the list from the page :home:list

.... usual form stuff...

selectfrom this_variable_name ":home:list"

Then you can use @@this_variable_name@@ in your form template. The end of the line can be a regexp which is applied at each line of the page to collect the content of the select list. The other one uses the hits from a dokuwiki query to set the content of a select list.

....

selectlist variablename "@home -start"

...

will define @@variablename@@ with the pagelist in :home except the start page.

Well, this is the idea, but I have not used them since I made them, waiting for feedback and interest from the community. If they do not care, I will spin it to a personal solution for my needs. (This is for an institute and it takes time to roll out.)

tomio13 avatar Aug 23 '18 14:08 tomio13

thx for your quick reply,

I think this is very usefull to make form Input more user friedly and error free...

I understood the selectform it works like expected, what do you think about a posibility to use the interpreted content of a page ?

Let's say we have a page with a indexmenu call, at the Moment i get the source {{indexmenu ...}} in the Dropdown. It would be very flexible to have the result of the indexmenu call in the Dropdown...

I'm still having some trouble with or feature requests for selectlist.

When I use:

selectlist "myvar" "@ns -start"

the startpages are visible in the Dropdown . may that's because of some dokuwiki config settings. I want to specify i.e nopg or nons and levels like with indexmenu plugin to have control over the list. Is this possible ?

I have more than one select list in my forms and should have dependancies in the lists.

The second list should be filled with the selection result of the first selection. The query Syntax shoul be able to use the content od the variable of preceeding form variables...

roadrunnerjb avatar Aug 23 '18 15:08 roadrunnerjb

Hi,

#This e-mail is a reply to the message of roadrunnerjb [email protected], sent on Thu, 23 Aug 2018 08:08:44 -0700:

#" thx for your quick reply,

I think this is very usefull to make form Input more user friedly and error free...

I understood the selectform it works like expected, what do you think about a posibility to use the interpreted content of a page ?

Let's say we have a page with a indexmenu call, at the Moment i get the source {{indexmenu ...}} in the Dropdown. It would be very flexible to have the result of the indexmenu call in the Dropdown...

I'm still having some trouble with or feature requests for selectlist.

When I use:

selectlist "myvar" "@ns -start"

the startpages are visible in the Dropdown . may that's because of some dokuwiki config settings. I want to specify i.e nopg or nons and levels like with indexmenu plugin to have control over the list. Is this possible ?

I have more than one select list in my forms and should have dependancies in the lists.

The second list should be filled with the selection result of the first selection. The query Syntax shoul be able to use the content od the variable of preceeding form variables...

#end of previous message"

Interpreted content is possible only if you do a double run, which is not how the bureaucracy plugin works. The key problem as I can see it is this is not how the plugin works.

The page form gets processed to generate the form. At this point we can do some searches, that is the proposed two fields do. Then the form is filled out and posted. This makes the action part active, which will do things with the content: create an email or make a new page.

What you want is that the first selection changes the next selection. However, the first selection needs to be processed, the reply generated and filled into a new version of the form, containing the newly generated selector.

This in general means that the first content needs to be posted, the server generates the content then the form updated accordingly. This can happen with a page reload or javascript doing the same in the background.

Thus, a new action part would be needed that updates the form each time one changes the selection of a specific field. I do not think this would be done soon, but I have not followed the newest features, since I failed submitting a patch. When I find some time I have to learn using the git system, because developing features that do not get noticed is not worth it for me.

Bests, T.

P.s.: Andi could reflect much better on this if he had some time.

tomio13 avatar Aug 23 '18 15:08 tomio13

Hi, a small correction: S: runs the ft_pageSearch() the built in search of Dokuwiki, otherwise a simple word is searched in the page name (with path).

So, selectlist "myvar" "S:@ns -start"

should work.

Summarizing the options:

selectlist "myvar" "S:@ns -start" --> do any searches Dokuwiki would do for you, get the full path back

selectlist "myvar" "S:@ns -start" "id" --> do the same, but get only the page ID

selectlist "myvar" "S:@ns -start" "ns" --> do the same, get only the namespace

selectlist "myvar" "test" --> get the namespace:name of all pages which have test in their name (or namespace). Then you can use the options of "id", "ns", "nl" again...

T.

tomio13 avatar Aug 23 '18 16:08 tomio13

Hi thank you for digging into this. but I still don't get what I need.

just to clarify the requirement:

I have an hierarchical tree of namespaces and want to preset in the dropdown all namespaces in a specific subtree and only one level deep.

Can you please point me to the reference for the search syntax as I need to limit the serch depth to one level

Is there a ft_namespaceSearch() in dokuwiki too ?

The source for your litte helpers may be cloned to use namespace search...

Regards J.

roadrunnerjb avatar Aug 23 '18 17:08 roadrunnerjb

Well, I do not have time to implement this right now, but changing the code at around line 140 in the case tree, you can add a part that splits the ns and keeps what you wanted. It is however an interesting request. I did try tuning a regexp for this in the dokuwiki search system, but failed miserably 8(.

tomio13 avatar Aug 23 '18 20:08 tomio13

Hello !

I've just discovered this helper for bureaucracy, I really appreciate it.

Few questions :

Is the zip file in the first post from 2016 is the last version available ?

Is there an option for selectlist to exclude sub-namespaces (returning only pages from the defined namespace) ?

Thanks, Fabrice

Edit : Another idea, it would be also nice to be able to use input datalist

chtiland avatar Jan 28 '24 12:01 chtiland

Hi chtiland, I am sorry, but after my user base did not pick upon the idea, I abandoned the project and did not keep it updated. At one point I may update the code to be compatible with the current Dokuwiki version though...

tomio13 avatar Jan 29 '24 12:01 tomio13

Hi @tomio13 ,

Thanks for your answer.

Yet both helper (from selectfrom-list.zip in your first post) seems to works fine with lastest "stables" versions of Dokuwiki and bureaucracy plugin.

Reading your previous exchanges, I was wondering if this was the last version you'd made.

Thanks

chtiland avatar Jan 30 '24 12:01 chtiland