/**
Checks if the entered topic name is a valid WikiWord.
Changed:
< <
If so, enables the submit button, if not: enables the submit button
> >
If so, enables the submit button, if not: enables the submit button if the user allows non-WikiWords as topic name; otherwise disables the submit button and returns 'false'.
Deleted:
< <
if the user allows non-WikiWords as topic name; otherwise disables the
submit button and returns 'false'.
Automatically removes spaces from entered name.
Automatically strips illegal characters.
If non-WikiWords are not allowed, capitalizes words (separated by space).
Added:
> >
If non-WikiWords are allowed, capitalizes sentence.
The generated topic name is written to a 'feedback' field.
@param inForm : pointer to the form
@param inShouldConvertInput : true: a new name is created from the entered name
@return True: submit is enabled and topic creation is allowed; false: submit is disabled and topic creation should be inhibited.
*/
function canSubmit(inForm, inShouldConvertInput) {
var inputForTopicName = inForm.topic.value;
Added:
> >
if (inputForTopicName) return;
Changed:
< <
// Topic names of zero length are not allowed
> >
/* Topic names of zero length are not allowed */
if (inputForTopicName.length == 0) {
disableSubmit(inForm.submit);
var userAllowsNonWikiWord = inForm.nonwikiword.checked;
// check if current input is a valid WikiWord
> >
var hasNonWikiWordCheck = (inForm.nonwikiword = undefined);
var userAllowsNonWikiWord = true;
if (hasNonWikiWordCheck) {
Added:
> >
userAllowsNonWikiWord = inForm.nonwikiword.checked;
}
/* check if current input is a valid WikiWord */
var noSpaceName = removeSpacesAndPunctiation(inputForTopicName);
Changed:
< <
// if necessary, create a WikiWord from the input name
// (when a non-WikiWord is not allowed)
> >
/*
if necessary, create a WikiWord from the input name
Added:
> >
(when a non-WikiWord is not allowed)
*/
var wikiWordName = noSpaceName;
if (userAllowsNonWikiWord) {
wikiWordName = removeSpacesAndPunctiation(capitalize(inputForTopicName));
Changed:
< <
}
> >
}
Added:
> >
if (userAllowsNonWikiWord) {
wikiWordName = removeSpacesAndPunctiation(capitalizeSentence(inputForTopicName));
}
if (inShouldConvertInput) {
Changed:
< <
if (userAllowsNonWikiWord) inForm.topic.value = noSpaceName;
if (userAllowsNonWikiWord) inForm.topic.value = wikiWordName;
> >
if (hasNonWikiWordCheck && userAllowsNonWikiWord) {
inForm.topic.value = noSpaceName;
Added:
> >
} else {
inForm.topic.value = wikiWordName;
}
}
Changed:
< <
// Update feedback field
> >
/* Update feedback field */
feedbackHeader = "Topic will be named: ";
feedbackText = feedbackHeader + wikiWordName;
insertHtml(feedbackText, "webTopicCreatorFeedback");
Changed:
< <
// Update hidden field value
// Use the negative value of the checkbox. This is the ugly way but must be used until edit script parameter allowsnonwikiword is implemented.
inForm.onlywikiname.value = userAllowsNonWikiWord ? "off" : "on";
> >
/*
Update hidden field value
Use the negative value of the checkbox. This is the ugly way but must be used until edit script parameter allowsnonwikiword is implemented.
*/
It's usually best to choose a WikiWord for the new topic name, otherwise automatic linking may not work. Characters not allowed in topic names, such as spaces will automatically be removed.
> >
It's usually best to choose a WikiWord for the new topic name, otherwise automatic linking may not work. Characters not allowed in topic names, such as spaces will automatically be removed.