Feature Proposal: Forbidding a subweb name same as a topic name
Motivation
Currently, even if the topic Solar.Mars exists, you can create the subweb Solar/Mars and vice versa. Partly because of this, you cannot view the home page of the subweb Solar/Jupiter by http://server/cgi-bin/view/Solar/Jupiter (without a trailing slash) even if the page Solar.Jupiter does not exist. This is inconsistent with the fact that you can view the home page of the Solar with by http://server/cgi-bin/view/Solar.
That's just a small inconvenience. But things get strange if you rename the topic Solar.Mars when there is the subweb Solar/Mars. This causes all attachments of Solar/Mars subweb topics inaccessible. A similar thing happens when the subweb Solar/Mars is renamed while the topic Solar.Mars has attachments.
Description and Documentation
If topic names and subweb names are guaranteed not to conflict, the issues mentioned above are gone.
Specifically:
- Attachments don't go missing due to a subweb-topic name conflict.
- The following enhancements can be implemented and turned on
- Allowing to access the home page of a subweb by its name without a trailing slash in URL.
- Solar.Mars and [[Solar.Mars]...] are regarded as links to the home page of the Solar/Mars subweb
- This makes UserSubwebs more transparent than otherwise. Main.FirstLast keeps working as a link to the user's page.
For backward compatibility, TWiki behaves conservatively.
- If Solar.Mars topic exists,
- http://server/cgi-bin/view/Solar/Mars shows the topic.
- Solar.Mars and [[Solar.Mars]...] become links to the topic.
- If the topic does not exists,
- http://server/cgi-bin/view/Solar/Mars shows the home page of Solar/Mars subweb.
- Solar.Mars and [[Solar.Mars]...] become links to the home page of Solar/Mars subweb.
Examples
Impact
Implementation
--
Contributors: HideyoImazu - 2012-07-03
lib/TWiki/Render.pm
- _renderWikiWord() now when the specified topic doesn't exist, it checks if the subweb exists.
lib/TWiki/UI/Manage.pm
- _createWeb() checks web-topic name conflict, throwing the topic_exists_new_web exception
- rename() checks topic-web name conflict, throwoing the web_exists_topic_rename exception
- renameWeb() checks web-topic name conflict, throwing the topic_exists_web_rename exception
lib/TWiki/UI/Edit.pm
- init_edit() checks topic-web name conflict, throwing the web_exists_topic_edit exception
lib/TWiki/UI/Save.pm
- buildNewToipc() checks topic-web name conflict, throwing the web_exists_topic_save exception
templates/messages.tmpl
The following messages are added.
- topic_exists_new_web
- web_exists_topic_rename
- topic_exists_web_rename
- web_exists_topic_edit
- web_exists_topic_save
Discussion
I consider this a bug that needs to be fixed. Yes, good spec to disallow web if topic of same name exists, and vice versa. I would not worry about backward compatibility and configure flag. Default behavior for legacy content in case both exist could be to ignore the topic?
--
PeterThoeny - 2012-07-03
I agree. I updated the Description section accordingly.
--
HideyoImazu - 2012-07-04
Looks good.
--
PeterThoeny - 2012-07-04
This is now accepted by 7 days feedback period.
--
PeterThoeny - 2012-07-11