Page 1 of 1

Automating composer pages: Columns

Posted: 21 Nov 2015 18:51
by BarryJ
I am trying to automate composer pages, several of which have >50 works in a subcategory.
Is there a way to arrange columns below {{#SortWorks:}}?
I created a dpl script with columns (see http://www.cpdl.org/wiki/index.php/Oliver_Holden), but unfortunately it isn't accepted as automation -- the Recent Additions dialog still appears. (or could I modify the dpl script?)
Thank you.
Barry Johnston

Re: Automating composer pages: Columns

Posted: 21 Nov 2015 20:17
by choralia
Bcjohnston523 wrote:the Recent Additions dialog still appears
The automated add work process is unable to recognize whether a composer page is automated already, as different automation tools exist (e.g., SortWorks, DPL) and others mat be added in the future. So, the Recent Additions template is added anyway, to stay on the safe side. The template can be easily removed then. Pages where the Recent Additions template is present are traced through a dedicated category, so it is also easy to locate any instances not removed yet.
Bcjohnston523 wrote:Is there a way to arrange columns below {{#SortWorks:}}?
Currently, columns are set by {{#SortWorks:}} as follows:

- if there are up to 20 items to list, one column is used;
- if there are 21 to 40 items to list, two columns are used;
- if there are more than 40 items to list, three columns are used.

The above rules can be changed, however this requires to modify the php script. I can do that.

Max

Re: Automating composer pages: Columns

Posted: 21 Nov 2015 20:51
by BarryJ
Thanks, Max! That helps a lot.
I have noticed that the length of work titles varies a lot. So it would help me if the editor could set the number of columns in {{#SortWorks:}}, perhaps defaulting to the current rules.
Thanks again.
Barry

Re: Automating composer pages: Columns

Posted: 21 Nov 2015 21:04
by choralia
What about a format like this:

{{#SortWorks: <subcategory> |<number of columns>}}

So, for example, {{#SortWorks:1800 works|4}} will list all works published in 1800, distributed on four columns.

If the subcategory is not specified, all composer's works are considered. If the number of columns is not specified, the default rules apply.

Makes sense?

Max

Re: Automating composer pages: Columns

Posted: 22 Nov 2015 04:57
by BarryJ
That makes sense, although
{{#SortWorks:<subcategory>|cols=<number of columns>}}
might be more consistent with other functions and templates.
But if you've already made the change, go with it.
Thanks!
Barry

Re: Automating composer pages: Columns

Posted: 22 Nov 2015 10:29
by choralia
Done, using the format {{#SortWorks:<subcategory>|cols=<number of columns>}}.

This page:

http://www.cpdl.org/wiki/index.php/Andrea_Gabrieli

already makes use of it, so that secular works are distributed on three columns, like sacred works (by default secular works would be distributed on two columns instead).

Please try to use it, and let me know about any glitches.

Max

Re: Automating composer pages: Columns

Posted: 23 Nov 2015 15:06
by BarryJ
Thank you very much!
This helps a bunch.
I've tried this on several pages, and it works well (better distribution of columns than my dpl script).
Is this documented somewhere in CPDL?

Barry

Re: Automating composer pages: Columns

Posted: 23 Nov 2015 18:06
by choralia
Bcjohnston523 wrote:Is this documented somewhere in CPDL?
Yes, of course:

http://www.cpdl.org/wiki/index.php/Help ... oser_pages

I updated this help page immediately after having activated the new cols= function. The description can be improved, of course, as I'm not a native English speaker.

Max