When you create a new topic from a template that does not exist, what should the message be?
--
TWiki:Main.ArthurClemens - 03 Mar 2008
"You are trying to create a topic using a templatetopic that does not exist" would be my best proposal
--
TWiki:Main.KennethLavrsen - 03 Mar 2008
in
messages.tmpl
%TMPL:DEF{"no_such_topic"}%
---++ %MAKETEXT{"[_1] topic does not exist" args="\"%WEB%.%TOPIC%\""}%
%MAKETEXT{"You are trying to [_1] a topic that does not exist." args="%PARAM1%"}%
---++ %MAKETEXT{"If you want to create the topic"}%
[[%SCRIPTURLPATH{"edit"}%/%WEB%/%TOPIC%?t=%SERVERTIME{"$year$mo$day$min$sec"}%][%MAKETEXT{"Create the topic"}%]].
%MAKETEXT{"Contact [_1] if you have any questions." args="%WIKIWEBMASTER%"}%
%TMPL:END%
Which is then used in
TWiki::UI::Edit
unless( $store->topicExists( $templateWeb, $templateTopic )) {
throw TWiki::OopsException(
'accessdenied',
def => 'no_such_topic',
web => $templateWeb,
topic => $templateTopic,
params => [ 'templatetopic' ] );
}
TWiki::UI::Save
if( $templatetopic ) {
( $templateweb, $templatetopic ) =
$session->normalizeWebTopicName( $templateweb, $templatetopic );
unless( $store->topicExists( $templateweb, $templatetopic )) {
throw TWiki::OopsException(
'attention',
def => 'no_such_topic',
web => $templateweb,
topic => $templatetopic,
params => [ 'template from' ] );
}
}
TWiki::UI::Manage
unless( $session->{store}->topicExists( $oldWeb, $oldTopic )) {
# Item3270: check for the same name starting with a lower case letter.
unless( $session->{store}->topicExists( $oldWeb, lcfirst $oldTopic )) {
throw TWiki::OopsException(
'accessdenied',
def => 'no_such_topic',
web => $oldWeb,
topic => $oldTopic,
params => [ 'rename' ] );
}
$oldTopic = lcfirst $oldTopic;
}
and TWiki::UI
sub checkTopicExists {
my ( $session, $webName, $topic, $op ) = @_;
ASSERT($session->isa( 'TWiki')) if DEBUG;
unless( $session->{store}->topicExists( $webName, $topic )) {
throw TWiki::OopsException( 'accessdenied',
def => 'no_such_topic',
web => $webName,
topic => $topic,
params => [ $op ] );
}
}
.... The case that Arthur reports is the one in TWiki::UI::Edit, but it feels to me like the others could also do with a little improvement.
HOWEVER the parameters to the MAKETEXTs are not translated, are they - which makes the entire thing a wee bit awkward.
--
TWiki:Main.SvenDowideit - 03 Apr 2008
It would make more sense to have a number of complete and translatable variations.
--
TWiki:Main.ArthurClemens - 03 Apr 2008
Done like this. Let's not forget to ask the translators to translate the new messages.
--
TWiki:Main.ArthurClemens - 03 May 2008