Not logged in. · Lost password · Register
Forum: General Help and Support Plugins RSS
Add New Page with auto-id
Page:  previous  1  2 
Avatar
hj #16
Member since Apr 2008 · 167 posts · Location: Lancaster, UK
Group memberships: Members
Show profile · Link to this post
In reply to post ID 65501
Hi pop,

Thanks for the thoughts on this. That solution is certainly worth trying.

The page name is a composite of the name of the page holding the form and the automatically assigned number.

The name of the generated page is a bit complicated. The page ID contains the year, the issue number and the article number with the issue of a journal which was issued each week during nearly fifty years. Each article is stored in its own page in the wiki.

Yes, I think a 'composite' page name may be necessary, perhaps containing date and subject as well as the article number (the one which sequentially increases on each submission).

If this can be done by bureaucracy without any other plugin, then this is certainly worth trying out.  I don't want to make the generated page name too long, but that will be trial and error with the bureaucracy field names, I think.
Avatar
hj #17
Member since Apr 2008 · 167 posts · Location: Lancaster, UK
Group memberships: Members
Show profile · Link to this post
Hi Myron,

So, if you could open a newpage with addnewpage and this newpage is named as, or contains, the next unique number in sequence, would this do what you want?  If so, I might have a solution for you.

That was the early thinking, yes.  Although I think I've gone past the addnewpage plugin, now - I've got into bureaucracy, which I rather like because it provides an entry form...which is a pretty foolproof way for the average user to submit data. 

And by the looks of what pop is saying, bureaucracy can provide an incremental numbering as part of the page name/ID.  So I think I'll be trying that route first.
Avatar
pop #18
Member since Nov 2016 · 123 posts
Group memberships: Members
Show profile · Link to this post
The solution I mentioned above does indeed produce numbered pages. However, there are two problems that I haven't been umable to solve so far.

One: when I invoke the action, bureaucracy does indeed add a page as requested. It also produces an error message on thop of the page holding the form which I can not explain. I have started a thread asking for advice for this particular problem, but there have been no useful replies so far.

Two: refreshing the page holding the form after invoking the action tries to add the page again, with the same number. This will, of course, not succeed as the page already exists, and Dokuwiki produces an error message indicating failure to create the page. That's not dangerous, but it's not nice.
Avatar
hj #19
Member since Apr 2008 · 167 posts · Location: Lancaster, UK
Group memberships: Members
Show profile · Link to this post
Your 'action' (I assume you mean template action) is quite convoluted - I can't quite make out what the @FORMPAGE_NS@ stuff is about.  I think I'll just try adding the simple @@Laufnummer@@ bit to my version!  ;-)

It will be interesting to see if there's an error message when I add that, too.  I'll try it tonight and let you know.

By the way, don't want to divert from this thread, but I have another bureaucracy issue here.  You seem to have a good grasp of bureaucracy, so maybe you could shed some light on it..?

cheers
Avatar
pop #20
Member since Nov 2016 · 123 posts
Group memberships: Members
Show profile · Link to this post
Quote by hj:
Your 'action' (I assume you mean template action) is quite convoluted - I can't quite make out what the @FORMPAGE_NS@ stuff is about.   (...)

As I've said before, I keep articles taken from a weekly publication in my wiki. To facilitate adding new pages and for easier maintenance of the navigation, I use a separate namespace for each year. This namespace holds one file for each issue and one namespace for all articles within the issues for one year.

The file for each issue contains the bureaucracy form for adding articles to the issue. The remainder of the issue does not concern us here.

Hence, the form I showed above is in the page :wochenblatt:1921:1921-02 where
:wochenblatt is the root for the publication named "wochenblatt" (German for "weekly")
:1921 is the year
:1921-02 is the name of the issue for the second week of the year 1921

The line starting with "ACTION template" tells the plugin that it is to create a new page when the user klicks on the submit button.

The term :include:wochenblattartikel within that line names the template file which I won't show here as it does not matter for now.

The last term :wochenblatt:@FORMPAGE_NS@:artikel:@FORMPAGE_PAGE@-@@Laufnummer@@ constructs the fully qualified ID for the new page It contains three variables:
@FORMPAGE_NS@ will be replaced by the name of the namespace where the page with the form lives, "1921" in this case
@FORMPAGE_PAGE@ will be replaced by the name of the page with the form, "1921-02" in this case
@@Laufnummer@@ will be replaced by the content of the field called Laufnummer within my form.

Hence, the form will produce pages of the form :wochenblatt:1921:artikel:1921-01-nn  where nn will be 00, 01, 02 ...

The variables named Formpage... are explained in https://www.dokuwiki.org/plugin:bureaucracy#template_mode , Use the brower's search function to find FORMPAGE_NS and so on.
Avatar
hj #21
Member since Apr 2008 · 167 posts · Location: Lancaster, UK
Group memberships: Members
Show profile · Link to this post
Right, I've got you. I think so, anyway!

The placeholders allow you to use a single bureaucracy form anywhere - on submission the pagename and destination are compiled by the action line which 'inherits' the namespace where the form resides and the page the form is on (without having to makes lots of different forms with subtly different action lines).

OK, I can see the value in that, and certainly in your case with so many different issues every year, it makes total sense.

In my case there may only be one or two destinations for submissions, and only one or two form pages - so it's probably not as necessary for me to use placeholders. EXCEPT.... it might be beneficial to use placeholders to maintain the correct order of pagename elements.  At the moment I'm just using a single @ to mark fields which are to be used in the pagename. But that means the pagename is constructed strictly in the order of the fields in the form.  If the article 'number' is at the top of your form, then that is the first element in the pagename.  I can see the way you do it possibly allows more control of pagename construction.

Thanks for the thorough tutorial!


edited to add:

In the bureaucracy documentation, what we are talking about is explained under the Defining the Destination(s) section.  Perhaps this section should be renamed Defining the Destination and Pagename.  It is not really clear until you read (and understand) Method 2, that this section is about naming the pages, not just defining where they are created.

If you are slow, like me (!), it takes a little while to recognise this!  ;-)
This post was edited on 2019-04-04, 01:57 by hj.
Avatar
pop #22
Member since Nov 2016 · 123 posts
Group memberships: Members
Show profile · Link to this post
Quote by hj:
OK, I can see the value in that, and certainly in your case with so many different issues every year, it makes total sense.
(...)
If you are slow, like me (!), it takes a little while to recognise this!  ;-)

I have to use one form for every single issue because I want the numbering for the articles in each issue to start from zero. The autonumbering field (laufnummer) is never reset.

I first tried placing the form into a separate file and including it with the include plugin in the page for each issue. This will not work as the autonumbering field will not budge. It has to occur in the topmost page that is displayed.

Well, yes, I did not say how many trials it took me to get this right. A certain amount of stubborness might be helpful. Also, it's only software and it's a wiki, and it will not break apart, particularly if you use a separate wiki for testing. Farming is your friend.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Page:  previous  1  2 
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-05-24, 09:37:45 (UTC +02:00)