any tips would help :D
Admin > Current Theme > Reset Options > Reset all member's current options for this theme
Quote from: jerm on September 23, 2006, 12:52:45 AM
Admin > Current Theme > Reset Options > Reset all member's current options for this theme
I don't see where the option he is asking for would be there?
Open Themes/default/MoveTopic.template.php
Find:
<label for="postRedirect"><input type="checkbox" name="postRedirect" id="postRedirect" checked="checked" onclick="document.getElementById(\'reasonArea\').style.display = this.checked ? \'block\' : \'none\';" class="check" />
Change to:
<label for="postRedirect"><input type="checkbox" name="postRedirect" id="postRedirect" onclick="document.getElementById(\'reasonArea\').style.display = this.checked ? \'block\' : \'none\';" class="check" />
And now? I think the code is different...
That same code is there in SMF 1.1.3.
How should I do this in 2.x?
Haven't checked, but most probably very similarly. At least, the same file would still handle this.
Have you checked if the code has changed much?
There's this:
<label for="postRedirect"><input type="checkbox" name="postRedirect" id="postRedirect" ', $context['is_approved'] ? 'checked="checked"' : '', ' onclick="', $context['is_approved'] ? '' : 'if (this.checked && !confirm(\'' . $txt['move_topic_unapproved_js'] . '\')) return false; ', 'document.getElementById(\'reasonArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check" /> ', $txt['moveTopic1'], '.</label>
I tried replacing that with the proposed one, and it worked otherwise but it shows the "Please enter a brief description as to
why this topic is being moved." field by default, which is not good since the option is obviously not even selected.
Try this line in place of the one you posted in reply #7
<label for="postRedirect"><input type="checkbox" name="postRedirect" id="postRedirect" ', $context['is_approved'] ? : '', ' onclick="', $context['is_approved'] ? '' : 'if (this.checked && !confirm(\'' . $txt['move_topic_unapproved_js'] . '\')) return false; ', 'document.getElementById(\'reasonArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check" /> ', $txt['moveTopic1'], '.</label>
Quote from: JimM on November 02, 2010, 08:56:28 PM
Try this line in place of the one you posted in reply #7
Still same thing. The description box goes away when I first check the "Post a redirection topic" option, and then uncheck it.
The whole MoveTopic template:
<?php
// Version: 2.0 RC3; MoveTopic
// Show an interface for selecting which board to move a post to.
function template_main()
{
global $context, $settings, $options, $txt, $scripturl;
echo '
<div id="move_topic" class="lower_padding">
<form action="', $scripturl, '?action=movetopic2;topic=', $context['current_topic'], '.0" method="post" accept-charset="', $context['character_set'], '" onsubmit="submitonce(this);">
<div class="cat_bar">
<h3 class="catbg">', $txt['move_topic'], '</h3>
</div>
<div class="windowbg centertext">
<span class="topslice"><span></span></span>
<div class="content">
<div class="move_topic">
<dl class="settings">
<dt>
<strong>', $txt['move_to'], ':</strong>
</dt>
<dd>
<select name="toboard">';
foreach ($context['categories'] as $category)
{
echo '
<optgroup label="', $category['name'], '">';
foreach ($category['boards'] as $board)
echo '
<option value="', $board['id'], '"', $board['selected'] ? ' selected="selected"' : '', $board['id'] == $context['current_board'] ? ' disabled="disabled"' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level']-1) . '=> ' : '', $board['name'], '</option>';
echo '
</optgroup>';
}
echo '
</select>
</dd>';
// Disable the reason textarea when the postRedirect checkbox is unchecked...
echo '
</dl>
<label for="reset_subject"><input type="checkbox" name="reset_subject" id="reset_subject" onclick="document.getElementById(\'subjectArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check" /> ', $txt['moveTopic2'], '.</label><br />
<fieldset id="subjectArea" style="display: none;">
<dl class="settings">
<dt><strong>', $txt['moveTopic3'], ':</strong></dt>
<dd><input type="text" name="custom_subject" size="30" value="', $context['subject'], '" class="input_text" /></dd>
</dl>
<label for="enforce_subject"><input type="checkbox" name="enforce_subject" id="enforce_subject" class="input_check" /> ', $txt['moveTopic4'], '.</label>
</fieldset>
<label for="postRedirect"><input type="checkbox" name="postRedirect" id="postRedirect" ', $context['is_approved'] ? 'checked="checked"' : '', ' onclick="', $context['is_approved'] ? '' : 'if (this.checked && !confirm(\'' . $txt['move_topic_unapproved_js'] . '\')) return false; ', 'document.getElementById(\'reasonArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check" /> ', $txt['moveTopic1'], '.</label>
<fieldset id="reasonArea" style="margin-top: 1ex;', $context['is_approved'] ? '' : 'display: none;', '">
<dl class="settings">
<dt>
', $txt['moved_why'], '
</dt>
<dd>
<textarea name="reason" rows="3" cols="40">', $txt['movetopic_default'], '</textarea>
</dd>
</dl>
</fieldset>
<div class="righttext">
<input type="submit" value="', $txt['move_topic'], '" onclick="return submitThisOnce(this);" accesskey="s" class="button_submit" />
</div>
</div>
</div>
<span class="botslice"><span></span></span>
</div>';
if ($context['back_to_topic'])
echo '
<input type="hidden" name="goback" value="1" />';
echo '
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
</form>
</div>';
}
?>
Hi Ihmeliö, sorry we disappeared on you - but have you had any luck with that since your last post?
I'll move this over to coding discussions, where I think this may get better responses ;)
Quote from: JimM on November 02, 2010, 08:56:28 PM
Try this line in place of the one you posted in reply #7
JimM suggestion should work.
Where you have
<label for="postRedirect"><input type="checkbox" name="postRedirect" id="postRedirect" ', $context['is_approved'] ? 'checked="checked"' : '', ' onclick="', $context['is_approved'] ? '' : 'if (this.checked && !confirm(\'' . $txt['move_topic_unapproved_js'] . '\')) return false; ', 'document.getElementById(\'reasonArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check" /> ', $txt['moveTopic1'], '.</label>
You should replace with
<label for="postRedirect"><input type="checkbox" name="postRedirect" id="postRedirect" onclick="', $context['is_approved'] ? '' : 'if (this.checked && !confirm(\'' . $txt['move_topic_unapproved_js'] . '\')) return false; ', 'document.getElementById(\'reasonArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check" /> ', $txt['moveTopic1'], '.</label>
Quote from: ups on November 16, 2010, 04:25:36 PM
Quote from: JimM on November 02, 2010, 08:56:28 PM
Try this line in place of the one you posted in reply #7
JimM suggestion should work.
Where you have
<label for="postRedirect"><input type="checkbox" name="postRedirect" id="postRedirect" ', $context['is_approved'] ? 'checked="checked"' : '', ' onclick="', $context['is_approved'] ? '' : 'if (this.checked && !confirm(\'' . $txt['move_topic_unapproved_js'] . '\')) return false; ', 'document.getElementById(\'reasonArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check" /> ', $txt['moveTopic1'], '.</label>
You should replace with
<label for="postRedirect"><input type="checkbox" name="postRedirect" id="postRedirect" onclick="', $context['is_approved'] ? '' : 'if (this.checked && !confirm(\'' . $txt['move_topic_unapproved_js'] . '\')) return false; ', 'document.getElementById(\'reasonArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check" /> ', $txt['moveTopic1'], '.</label>
Ah, hmm. For some reason it doesn's save that particular change when I press "Save changes". I tried adding a comment line into the file, and that one does save, but changing the above mentioned code always reverts back...
That's strange, how you tried editing the file directly with something like Notepad++ ?
Quote from: LexArma on November 17, 2010, 06:39:52 AM
That's strange, how you tried editing the file directly with something like Notepad++ ?
No. I tried now though, and it partly works. Still got this problem:
Quote from: Ihmeliö on November 01, 2010, 07:24:47 PM
I tried replacing that with the proposed one, and it worked otherwise but it shows the "Please enter a brief description as to
why this topic is being moved." field by default, which is not good since the option is obviously not even selected.
It seems that these controls are controlled of the $context['is_approved'] variable. A bit unrelated if you ask me. It should be and independent one.
Anyway: you also have to hide the reason textbox by default.
<fieldset id="reasonArea" style="margin-top: 1ex;', $context['is_approved'] ? '' : 'display: none;', '">
to
<fieldset id="reasonArea" style="margin-top: 1ex; display: none;">
Ok, that works. Tough I'm still interested in why can't I apply the change directly through the forum software.
edit: If I wanted to completely remove the redirection option, how would I do that?
That is just probably an option that the SMF team made. A MOD can be created to enable or disable the redirect in the control panel.
One possible fix is simply to remove the redirect checkbox from the template by removing:
<label for="postRedirect"><input type="checkbox" name="postRedirect" id="postRedirect" onclick="', $context['is_approved'] ? '' : 'if (this.checked && !confirm(\'' . $txt['move_topic_unapproved_js'] . '\')) return false; ', 'document.getElementById(\'reasonArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check" /> ', $txt['moveTopic1'], '.</label>
<fieldset id="reasonArea" style="margin-top: 1ex; display: none;">
<dl class="settings">
<dt>
', $txt['moved_why'], '
</dt>
<dd>
<textarea name="reason" rows="3" cols="40">', $txt['movetopic_default'], '</textarea>
</dd>
</dl>
</fieldset>
This way, a new redirect cannot be set without some hacking.
To completely remove the feature, more code would have to be changed.
Another option that I consider a bit more elegant is to disable the checkbox by using the "disabled" keyword
<label for="postRedirect"><input disabled type="checkbox" name="postRedirect" id="postRedirect" onclick="', $context['is_approved'] ? '' : 'if (this.checked && !confirm(\'' . $txt['move_topic_unapproved_js'] . '\')) return false; ', 'document.getElementById(\'reasonArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check" /> ', $txt['moveTopic1'], '.</label>
Is just a matter of how strongly you want to disable the redirects...
In 2.0 RC5 i found the following solution
If you only want to remove only the checkbox you need to remove the checkbox checked command:
$context['is_approved'] ? 'checked="checked"' : '', ' onclick="',
So in the Themes/Default/MoveTopictemplate.php change line 53:
from
<label for="postRedirect"><input type="checkbox" name="postRedirect" id="postRedirect" ',$context['is_approved'] ? 'checked="checked"' : '', ' onclick="', $context['is_approved'] ? '' : 'if (this.checked && !confirm(\'' . $txt['move_topic_unapproved_js'] . '\')) return false; ', 'document.getElementById(\'reasonArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check" /> ', $txt['moveTopic1'], '.</label>
Into this:
<label for="postRedirect"><input type="checkbox" name="postRedirect" id="postRedirect" ',$context['is_approved'] ? '' : 'if (this.checked && !confirm(\'' . $txt['move_topic_unapproved_js'] . '\')) return false; ', 'document.getElementById(\'reasonArea\').style.display = this.checked ? \'block\' : \'none\';" class="input_check" /> ', $txt['moveTopic1'], '.</label>
Everything else works like it should be, this just removes the default "checked" status.
Many thanks guys for posting your solutions. One of my mods constantly forgets to uncheck this option while moving topics.
IMO the most elegant way would be to make the CheckBox unchecked with no TextArea. But.. it the user clicks and checks the CheckBox the reason TextArea should appear.
I'm not so advanced in PHP so for the time being will use the Nvb's solution since it doesn't require too many changes.