You are here:
DBG/400
>
DBG400 Web
>
WebTopicCreator
(revision 3) (raw view)
Edit
Attach
---+ %MAKETEXT{"Create New Topic in [_1] Web" args="<nop>%BASEWEB%"}% %STARTSECTION{"formstart"}% <script type="text/javascript" src="%PUBURLPATH%/%TWIKIWEB%/TWikiJavascripts/unicode_chars.js"></script> <script type="text/javascript"> //<![CDATA[ /** Checks if the entered topic name is a valid WikiWord. 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'. Automatically removes spaces from entered name. Automatically strips illegal characters. If non-WikiWords are not allowed, capitalizes words (separated by space). 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; // Topic names of zero length are not allowed if (inputForTopicName.length == 0) { disableSubmit(inForm.submit); // Update feedback field insertHtml("", "webTopicCreatorFeedback"); return false; } var userAllowsNonWikiWord = inForm.nonwikiword.checked; // check if current input is a valid WikiWord var noSpaceName = removeSpacesAndPunctiation(inputForTopicName); // if necessary, create a WikiWord from the input name // (when a non-WikiWord is not allowed) var wikiWordName = noSpaceName; if (!userAllowsNonWikiWord) { wikiWordName = removeSpacesAndPunctiation(capitalize(inputForTopicName)); } if (inShouldConvertInput) { if (userAllowsNonWikiWord) inForm.topic.value = noSpaceName; if (!userAllowsNonWikiWord) inForm.topic.value = wikiWordName; } // Update feedback field feedbackHeader = "<strong>%MAKETEXT{"Topic will be named: "}%</strong>"; feedbackText = feedbackHeader + wikiWordName; insertHtml(feedbackText, "webTopicCreatorFeedback"); // 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"; if (isWikiWord(wikiWordName) || userAllowsNonWikiWord) { enableSubmit(inForm.submit); return true; } else { disableSubmit(inForm.submit); return false; } } /** @param inState: true or false */ function setCheckBoxState (inCheckBox, inState) { inCheckBox.checked = inState; } function enableSubmit(inButton) { removeClass(inButton, "twikiSubmitDisabled"); inButton.disabled = false; } function disableSubmit(inButton) { addClass(inButton, "twikiSubmitDisabled"); inButton.disabled = true; } //]]> </script> <form name="newtopic" id="newtopic" action="%SCRIPTURLPATH{edit}%/%BASEWEB%/" onsubmit="return canSubmit(this,true);">%ENDSECTION{"formstart"}% <div class="twikiFormSteps"> <div class="twikiFormStep"> ---+++ %MAKETEXT{"Topic name:"}% <p>%STARTSECTION{"topicname"}%<input type="text" class="twikiInputField" name="topic" id="topic" size="40" tabindex="10" %IF{"'%PREFILLTOPIC%'='1'" then="value=\"%BASETOPIC%\"" else="value=\"\""}% onkeyup="canSubmit(this.form,false);" onchange="canSubmit(this.form,false);" onblur="canSubmit(this.form,true);" /> <span id="webTopicCreatorFeedback" class="twikiInputFieldDisabled"><!--generated name will be put here--></span>%ENDSECTION{"topicname"}%</p> <p>%STARTSECTION{"allownonwikiword"}%<input type="checkbox" class="twikiCheckbox" id="nonwikiword" name="nonwikiword" tabindex="11" onchange="canSubmit(this.form,false);" onmouseup="canSubmit(this.form,false);" /><label for="nonwikiword">%MAKETEXT{"Allow non <nop>WikiWord for the new topic name"}%</label><br /> <span class="twikiGrayText">%MAKETEXT{"It's usually best to choose a <a target='WikiWord' onclick=\"return launchWindow('[_1]','WikiWord')\" href='[_1]' rel='nofollow'>WikiWord</a> for the new topic name, otherwise automatic linking may not work. Characters not allowed in topic names, such as spaces will automatically be removed." args="%TWIKIWEB%,%SCRIPTURLPATH{"view"}%/%TWIKIWEB%/WikiWord"}%</span>%ENDSECTION{"allownonwikiword"}%</p> </div><!--/twikiFormStep--> <div class="twikiFormStep"> ---+++ %MAKETEXT{"Topic parent:"}% <p>%STARTSECTION{"topicparent"}%<select name="topicparent" size="10" tabindex="12"> %TOPICLIST{"<option $marker value='$name'>$name</option>" separator=" " selection="%URLPARAM{ "parent" default="%MAKETEXT{"(no parent, orphaned topic)"}%" }%"}% <option value="">%MAKETEXT{"(no parent, orphaned topic)"}%</option> </select>%ENDSECTION{"topicparent"}%</p> </div><!--/twikiFormStep--> <div class="twikiFormStep twikiLast"> <p>%STARTSECTION{"submit"}%<input id="submit" type="submit" class="twikiSubmit" tabindex="13" value='%MAKETEXT{"Create this topic"}%' />%ENDSECTION{"submit"}%</p> </div><!--/twikiFormStep--> </div><!--/twikiFormSteps--> %STARTSECTION{"formend"}%<input type="hidden" name="onlywikiname" /> <input type="hidden" name="onlynewtopic" value="on" /> </form> <script type="text/javascript"> //<![CDATA[ // Read url param 'allowsnonwikiword' to set the initial checkbox value var allowsNonWikiWord = "%URLPARAM{"allowsnonwikiword" default=off}%"; setCheckBoxState(document.forms.newtopic.nonwikiword, allowsNonWikiWord.toBoolean() ? true : false); // start with a check canSubmit(document.forms.newtopic,false); // focus input field document.forms.newtopic.topic.focus(); //]]> </script>%ENDSECTION{"formend"}% %BR% <div class="twikiHelp"> %ICON{info}% %MAKETEXT{"Once you have created the topic, consider adding links in related topics to the new topic so that there are more ways people can discover it."}% </div>
Edit
|
Attach
|
P
rint version
|
H
istory
:
r5
|
r4
<
r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Edit WikiText
|
More topic actions...
Topic revision: r3 - 25 Jun 2006 - 16:26:30 -
TWikiContributor
?
DBG400
Log In
DBG400 Web
Index
Search
Changes
Notifications
Statistics
Site Map
Downloads
Webs
DBG400
Jamaro
Main
Sandbox
Sandtub
System
Send a link to this page
Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding DBG/400?
Send feedback