]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/inline_postform_autotitles.mdwn
(no commit message)
[ikiwiki.git] / doc / todo / inline_postform_autotitles.mdwn
1 [[!tag wishlist patch plugins/inline]]
2 [[!template id=gitbranch branch=chrysn/patches author="[[chrysn]]"]]
3
4 for postforms in inlines of pages which follow a certain scheme, it might not
5 be required to set the title for each individual post, but to automatically set
6 the title and show no input box prompting for it.
7 this can either be based on timestamp formatting, or use the already existing
8 munging mechanism, which appends numbers to page titles in case that page
9 already exists.
10
11 two patches ([1], [2]) set inline up for that, adding an additional `autotitle`
12 parameter. if that is given, the regular input of the inline postform will be
13 replaced with a hidden input of that text. in addition, the empty title is
14 permitted (both for autotitle and regular titles, as they go in the same GET
15 parameter, `title`). as the empty page title is illegal, munging is used,
16 resulting in ascending numeric page titles to be created.
17
18 the second patch is actually a one-liner, filtering the title through strftime.
19
20 > Something similar was requested in [[todo/more_customisable_titlepage_function]],
21 > in which [[Joey]] outlined a similar solution.
22 >
23 > What's your use-case for not prompting for the title at all? I can see
24 > [[madduck]]'s requirement for the title he typed in (say, "foo")
25 > being transformed into 2009/07/26/foo or something (I name blog posts
26 > like that myself), but I can't quite see the use for *entirely* automatic
27 > titles.
28 >
29 > However, if that's really what you want, I suspect your code could be
30 > extended so it also solves madduck's second request on
31 > [[todo/more_customisable_titlepage_function]].
32 >
33 > --[[smcv]]
34
35 ### potential user interaction issues
36
37 this has two side effects which have to be considered: first, the empty page
38 title is accepted also in normal postforms (previously, this resulted in a "bad
39 page name" error); second, entering a percent sign in that field might result
40 in unexpexted strftime substitution (strftime might not even substitute for
41 common uses of percent as in "reach 10% market share", but might in others as
42 in "the 10%-rule").
43
44 both can be circumvented by using another GET parameter for autotexts, as
45 implemented in [3].
46 > this patch still does not work perfectly; especially, it should make a
47 > distinction between "autotitle is set but equal ''" (in which case it
48 > should create a page named `1.mdwn`, and "autotitle is not set, and title is
49 > equal ''" (in which case it should display the old error message) --[[chrysn]]
50
51 ### potential security issues
52
53 * the autotitle's value is directly output through the template (but that's
54   done in other places as well, so i assume it's safe)
55 * i don't know if anything bad can happen if unfiltered content is passed to
56   POSIX::strftime.
57
58 ### further extension
59
60 having a pre-filled input field instead of an unchangable hidden input might be
61 cool (eg for creating an entry with yesterday's date), but would be a bit of a
62 problem with static pages. javascript could help with the date part, but name
63 munging would be yet another thing.
64
65 [1]: http://github.com/github076986099/ikiwiki/commit/b568eb257a3ef5ff49a84ac00a3a7465b643c1e1
66 [2]: http://github.com/github076986099/ikiwiki/commit/34bc82f232be141edf036d35e8ef5aa289415072
67 [3]: http://github.com/github076986099/ikiwiki/commit/40dc10a4ec7809e401b4497c2abccfba30f7a2af