
'Create New Topic' page has movedContinue to create the new page | ||||||||
| Changed: | ||||||||
| < <  | All WebTopicCreator topic on this site: | |||||||
| > >  | All WebTopicCreator topics on this site: | |||||||
 Create New Topic in TWiki Web | ||||||||
| Changed: | ||||||||
| < <  | View templates | |||||||
| > >  | View templates | |||||||
<--/twikiFormStep--> <--/twikiFormStep--> <--/twikiFormSteps-->  | ||||||||
 Create New Topic in TWiki Web | ||||||||
| Added: | ||||||||
| > >  | ||||||||
| Added: | ||||||||
| > >  | ||||||||
| Changed: | ||||||||
| < <  | // | |||||||
| > >  | /* | |||||||
| /** 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); | ||||||||
| Changed: | ||||||||
| < <  | // Update feedback field | |||||||
| > >  | /* Update feedback field */ | |||||||
| insertHtml("", "webTopicCreatorFeedback"); return false; } | ||||||||
| Changed: | ||||||||
| < <  | 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.
	*/ | |||||||
| Added: | ||||||||
| > >  | if (hasNonWikiWordCheck && userAllowsNonWikiWord) { inForm.onlywikiname.value = userAllowsNonWikiWord ? "off" : "on"; } | |||||||
| if (isWikiWord(wikiWordName) || userAllowsNonWikiWord) { enableSubmit(inForm.submit); return true; } else { disableSubmit(inForm.submit); return false; } } | ||||||||
| Added: | ||||||||
| > >  | function capitalizeSentence (inText) { return inText.substr(0,1).toUpperCase() + inText.substr(1); } | |||||||
| /** @param inState: true or false */ function setCheckBoxState (inCheckBox, inState) { | ||||||||
| Added: | ||||||||
| > >  | if (! inCheckBox) return; | |||||||
| inCheckBox.checked = inState; } function enableSubmit(inButton) { | ||||||||
| Added: | ||||||||
| > >  | if (inButton) return; | |||||||
| removeClass(inButton, "twikiSubmitDisabled"); inButton.disabled = false; } function disableSubmit(inButton) { | ||||||||
| Added: | ||||||||
| > >  | if (inButton) return; | |||||||
| addClass(inButton, "twikiSubmitDisabled"); inButton.disabled = true; } | ||||||||
| Changed: | ||||||||
| < <  | //]]> | |||||||
| > >  | /* ]]> */ | |||||||
| Changed: | ||||||||
| < <  | ||||||||
| > >  | ||||||||
| Added: | ||||||||
| > >  | ||||||||
| Changed: | ||||||||
| < <  | Topic name:   | |||||||
| > >  | Topic name:   | |||||||
| Changed: | ||||||||
| < <  | 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. | |||||||
| Added: | ||||||||
| > >  | ||||||||
<--/twikiFormStep-->  | ||||||||
| Changed: | ||||||||
| < <  | Topic parent: | |||||||
| > >  | Topic parent: | |||||||
<--/twikiFormStep-->  | ||||||||
| Added: | ||||||||
| > >  | <--/twikiFormStep-->  | |||||||
<--/twikiFormStep--> <--/twikiFormSteps-->  | ||||||||
| Changed: | ||||||||
| < <  | ||||||||
| > >  | ||||||||
| Deleted: | ||||||||
| < <  | ||||||||
| Added: | ||||||||
| > >  | ||||||||
  | ||||||||
| Added: | ||||||||
| > >  | Create New Topic in TWiki Web | |||||||
| Changed: | ||||||||
| < <  | ||||||||
| > >  | ||||||||
| Deleted: | ||||||||
| < <  | Create New Topic in TWiki Web | |||||||
| Changed: | ||||||||
| < <  | 
 <-- TODO: move JS to a separate file and make it callable on click of the button too --> <-- TODO: blank out all the irrelevant links: Edit, Compose, Attach, Printable, ... Raw text, versions, History, More topic actions: could this be a CSS? -->  | |||||||
| > >  |   
  | |||||||
| Deleted: | ||||||||
| < <  | 
 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.  | |||||||
<--/twikiFormStep-->  | ||||||||
| Changed: | ||||||||
| < <  | ||||||||
| > >  | ||||||||
| Changed: | ||||||||
| < <  | ||||||||
| > >  | ||||||||
<--/twikiFormStep-->  | ||||||||
| Changed: | ||||||||
| < <  | ||||||||
| > >  | ||||||||
<--/twikiFormStep--> <--/twikiFormSteps-->  | ||||||||
| Changed: | ||||||||
| < <  | ||||||||
| > >  | ||||||||
| Added: | ||||||||
| > >  | ||||||||
  | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Changed: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| < <  | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > >  | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Added: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > >  | //WikiWord
  if (inForm.nonwikiword.checked == true) {
    return removeSpaces(inValue);
  }
  var sIn = inValue;
  var sOut = '';
  var chgUpper = true;
  for ( var i = 0; i < sIn.length; i++ ) {
    var ch = sIn.charAt( i );
    if( ch!=' ' ) {
      if( chgUpper ) {
        ch = ch.toUpperCase();
        chgUpper = false;
      }
    }
    if( ch==' ' ) {
      chgUpper = true;
    } else {
      chgUpper = false;
    }
    sOut += ch;
  }
  return removeSpaces(sOut); 
}
function removeSpaces(inValue) {
  var sIn = inValue;
  var sOut = '';
  for ( var i = 0; i < sIn.length; i++ ) {
    var ch = sIn.charAt( i );
    if( ch==' ' ) {
      chgUpper = true;
      continue;
    }
    sOut += ch;
  }
  return sOut;
}
function canSubmit(inForm) {
  inForm.topic.value = capitalize(inForm, inForm.topic.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 = (inForm.nonwikiword.checked == true) ? "off" : "on";
  return true;
}
//]]>
 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Create New Topic in TWiki Web | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Changed: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| < <  | 
 Revision 12005-11-08 - TWikiContributor
 View topic | History:  r7 < r6 < r5 < r4 | More topic actions... Ideas, requests, problems regarding TWiki? Send feedback Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.WebTopicCreator.  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||