]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/Moving_Pages.mdwn
response
[ikiwiki.git] / doc / todo / Moving_Pages.mdwn
1 I thought I'd draw attention to a desire of mine for **ikiwiki**.  I'm no power-user, and mostly I do fairly simple stuff with my [wiki](http://kitenet.net/~kyle/family/wiki).
2
3 However, I would like the ability (now) to **rename/move/delete** pages.  As part of having a genealogy wiki, I've put name and dates of birth/death as part of the title of each article (so to avoid cases where people have the same name, but are children/cousins/etc of others with that name).  However, some of this information changes.  For instance, I didn't know a date of death and now I do, or I had it wrong originally, or it turns out someone is still alive I didn't know about.  All of these cases leave me with bad article titles.
4
5 So, I can go ahead and move the file to a new page with the correct info, orphan that page, provide a link for the new page if desired, and otherwise ignore that page.  But then, it clutters up the wiki and serves no useful purpose.
6
7 Anyway to consider implementing **rename/move/delete** ?  I certainly lack the skills to appreciate what this would entail, but feel free to comment if it appears impossible, and then I'll go back to the aforementioned workaround.  I would prefer simple rename, however.
8
9 Thanks again to [Joey](http://kitenet.net/~joey) for putting ikiwiki together.  I love the program. 
10
11 *[Kyle](http://kitenet.net/~kyle/)=*
12
13 ----
14
15 The MediaWiki moving/renaming mechanism is pretty nice.  It's easy to get a list of pages that point to the current page.  When renaming a page it sticks a forwarding page in the original place.  The larger the size of the wiki the more important organization tools become.
16
17 I see the need for:
18
19 * a new type of file to represent a forwarding page
20 * a rename tool that can
21   * move the existing page to the new name
22   * optionally drop a forwarding page
23   * optionally rewrite incoming links to the new location
24
25 Brad
26
27 > This could be implemented through the use of an HTTP redirect to the 
28 > new page, but this has the downside that people may not know they're being 
29 > redirected.
30 >
31 > This could also be implemented using a combination of raw inline and meta
32 > to change the title (add a "redirected from etc." page. This could be done
33 > with a plugin. A redirect page would be [[!redirect page="newpage"]].
34 > But then if you click "edit" on this redirect page, you won't be able
35 > to edit the new page, only the call to redirect.
36 > --Ethan
37
38 -----
39
40 I'm going to try to run through a full analysis and design for moving and
41 deleting pages here. I want to make sure all cases are covered. --[[Joey]]
42
43 ## UI
44
45 The UI I envision is to add "Rename" and "Delete" buttons to the file edit
46 page. Both next to the Save button, and also at the bottom of the attachment
47 management interface.
48
49 The attachment(s) to rename or delete would be selected using the check boxes
50 and then the button applies to all of them. Deleting multiple attachments
51 in one go is fine; renaming multiple attachments in one go is ambiguous,
52 and it can just error out if more than one is selected for rename.
53 (Alternatively, it could allow moving them all to a different subdirectory.)
54
55 The Delete buttons lead to a page to confirm the deletion(s).
56
57 The Rename buttons lead to a page with a text edit box for editing the
58 page name. The title of the page is edited, not the actual filename.
59
60 There will also be a optional comment field, so a commit message can be
61 written for the rename/delete.
62
63 Note that there's an edge case concerning pages that have a "/" encoded
64 as part of their title. There's no way for a title edit box to
65 differentiate between that, and a "/" that is instended to refer to a
66 subdirectory to move the page to. Consequence is that "/" will always be
67 treated literally, as a subdir separator; it will not be possible to use
68 this interface to put an encoded "/" in a page's name.
69
70 Once a page is renamed, ikiwiki will return to the page edit interface,
71 now for the renamed page. Any modifications that the user had made to the
72 textarea will be preserved.
73
74 Similarly, when an attachment is renamed, or deleted, return to the page
75 edit interface (with the attachments displayed).
76
77 When a page is deleted, redirect the user to the toplevel index.
78
79 Note that this design, particularly the return to the edit interface after
80 rename, means that the rename button can *only* be put on the page edit ui.
81 It won't be possible to put it on the action bar or somewhere else. (It
82 would be possible to code up a different rename button that doesn't do
83 that, and use it elsewhere.)
84
85 Hmm, unless it saves the edit state and reloads it later, while using a separate
86 form. Which seems to solve other problems, so I think is the way to go.
87
88 ## SubPages
89
90 When renaming `foo`, it probably makes sense to also rename
91 `foo/Discussion`. Should other SubPages in `foo/` also be renamed? I think
92 it's probably simplest to rename all of its SubPages too.
93
94 (For values of "simplest" that don't include the pain of dealing with all
95 the changed links on subpages.. as well as issues like pagespecs that
96 continue to match the old subpages, and cannot reasonably be auto-converted
97 to use the new, etc, etc... So still undecided about this.)
98
99 When deleting `foo`, I don't think SubPages should be deleted. The
100 potential for mistakes and abuse is too large. Deleting Discussion page
101 might be a useful exception.
102
103 TODO: Currently, subpages are not addressed.
104
105 ## link fixups
106
107 When renaming a page, it's desirable to keep links that point to it
108 working. Rather than use redirection pages, I think that all pages that
109 link to it should be modified to fix their links.
110
111 The rename plugin can add a "rename" hook, which other plugins can use to
112 update links &etc. The hook would be passed page content, the old and new
113 link names, and would modify the content and return it. At least the link
114 plugin should have such a hook.
115
116 After calling the "rename" hook, and rendering the wiki, the rename plugin
117 can check to see what links remain pointing to the old page. There could
118 still be some, for example, CamelCase links probably won't be changed; img
119 plugins and others contain logical links to the file, etc. The user can be
120 presented with a list of all the pages that still have links to the old
121 page, and can manually deal with them.
122
123 In some cases, a redirection page will be wanted, to keep long-lived urls
124 working. Since the meta plugin supports creating such pages, and since they
125 won't always be needed, I think it will be simplest to just leave it up to
126 the user to create such a redirection page after renaming a page.
127
128 ## who can delete/rename what?
129
130 The source page must be editable by the user to be deleted/renamed.
131 When renaming, the dest page must not already exist, and must be creatable
132 by the user, too.
133
134 lWhen deleting/renaming attachments, the `allowed_attachments` PageSpec
135 is checked too.
136
137 ## RCS
138
139 Three new functions are added to the RCS interface:
140
141 * `rcs_remove(file)`
142 * `rcs_rename(old, new)`
143 * `rcs_commit_staged(message, user, ip)`
144
145 See [[rcs_updates_needed_for_rename_and_remove]].
146
147 ## conflicts
148
149 Cases to consider:
150
151 * Alice clicks "delete" button for a page; Bob makes a modification;
152   Alice confirms deletion. Ideally in this case, Alice should get an error
153   message that there's a conflict.
154   Update: In my current code, alice's deletion will fail if the file was
155   moved or deleted in the meantime; if the file was modified since alice
156   clicked on the delete button, the modifications will be deleted too. I
157   think this is acceptable.
158 * Alice opens edit UI for a page; Bob makes a modification; Alice
159   clicks delete button and confirms deletion. Again here, Alice should get
160   a conflict error. Note that this means that the rcstoken should be
161   recorded when the edit UI is first opened, not when the delete button is
162   hit.
163   Update: Again here, there's no conflict, but the delete succeeds. Again,
164   basically acceptible.
165 * Alice and Bob both try to delete a page at the same time. It's fine for
166   the second one to get a message that it no longer exists. Or just to
167   silently fail to delete the deleted page..
168   Update: It will display an error to the second one that the page doesn't
169   exist.
170 * Alice deletes a page; Bob had edit window open for it, and saves
171   it afterwards. I think that Bob should win in this case; Alice can always
172   notice the page has been added back, and delete it again.
173   Update: Bob wins.
174 * Alice clicks "rename" button for a page; Bob makes a modification;
175   Alice confirms rename. This case seems easy, it should just rename the
176   modified page.
177   Update: it does
178 * Alice opens edit UI for a page; Bob makes a modification; Alice
179   clicks rename button and confirms rename. Seems same as previous case.
180   Update: check
181 * Alice and Bob both try to rename a page at the same time (to probably
182   different names). Or one tries to delete, and the other to rename. 
183   I think it's acceptible for the second one to get an error message that
184   the page no longer exists.
185   Update: check, that happens
186 * Alice renames a page; Bob had edit window open for it, and saves
187   it afterwards, under old name. I think it's acceptible for Bob to succeed
188   in saving it under the old name in this case, though not ideal.
189   Update: Behavior is the same as if Alice renamed the page and Bob created
190   a new page with the old name. Seems acceptable, though could be mildly
191   confusing to Bob (or Alice).
192 * Alice starts creating a new page. In the meantime, Bob renames a
193   different page to that name. Alice should get an error message when
194   committing; and it should have conflict markers. Ie, this should work the
195   same as if Bob had edited the new page at the same time as Alice did.
196   Update: That should happen. Haven't tested this case yet to make sure.
197 * Bob starts renaming a page. In the meantime, Alice creates a new page
198   with the name he's renaming it to. Here Bob should get a error message
199   that he can't rename the page to an existing name. (A conflict resolution
200   edit would also be ok.)
201   Update: Bob gets an error message.
202 * Alice renames (or deletes) a page. In the meantime, Bob is uploading an
203   attachment to it, and finishes after the rename finishes. Is it
204   acceptible for the attachment to be saved under the old name?
205   Update: Meh. It's certianly not ideal; if Bob tries to save the page he
206   uploaded the attachment to, he'll get a message about it having been
207   deleted/renamed, and he can try to figure out what to do... :-/
208 * I don't know if this is a conflict, but it is an important case to consider;
209   you need to make sure that there are no security holes.  You dont want
210   someone to be able to rename something to <code>/etc/passwd</code>.
211   I think it would be enough that you cannot rename to a location outside
212   of srcdir, you cannot rename to a location that you wouldn't be able
213   to edit because it is locked, and you cannot rename to an existing page.
214
215   > Well, there are a few more cases (like not renaming to a pruned
216   > filename, and not renaming _from_ a file that is not a known source
217   > file or is locked), but yes, that's essentially it.
218   > 
219   > PS, the first thing I do to any
220   > web form is type /etc/passwd and ../../../../etc/passwd into it. ;-) --[[Joey]]