function template_issueWarning() { global $context, $settings, $options, $scripturl, $modSettings, $txt; template_load_warning_variables(); echo ' <script type="text/javascript"><!-- // --><![CDATA[ function setWarningBarPos(curEvent, isMove, changeAmount) { barWidth = ', $context['warningBarWidth'], '; // Are we passing the amount to change it by? if (changeAmount) { if (document.getElementById(\'warning_level\').value == \'SAME\') percent = ', $context['member']['warning'], ' + changeAmount; else percent = parseInt(document.getElementById(\'warning_level\').value) + changeAmount; } // If not then it\'s a mouse thing. else { if (!curEvent) var curEvent = window.event; // If it\'s a movement check the button state first! if (isMove) { if (!curEvent.button || curEvent.button != 1) return false } // Get the position of the container. contain = document.getElementById(\'warning_contain\'); position = 0; while (contain != null) { position += contain.offsetLeft; contain = contain.offsetParent; } // Where is the mouse? if (curEvent.pageX) { mouse = curEvent.pageX; } else { mouse = curEvent.clientX; mouse += document.documentElement.scrollLeft != "undefined" ? document.documentElement.scrollLeft : document.body.scrollLeft; } // Is this within bounds? if (mouse < position || mouse > position + barWidth) return; percent = Math.round(((mouse - position) / barWidth) * 100); // Round percent to the nearest 5 - by kinda cheating! percent = Math.round(percent / 5) * 5; } // What are the limits? minLimit = ', $context['min_allowed'], '; maxLimit = ', $context['max_allowed'], '; percent = Math.max(percent, minLimit); percent = Math.min(percent, maxLimit); size = barWidth * (percent/100); setInnerHTML(document.getElementById(\'warning_text\'), percent + "%"); document.getElementById(\'warning_text\').innerHTML = percent + "%"; document.getElementById(\'warning_level\').value = percent; document.getElementById(\'warning_progress\').style.width = size + "px"; // Get the right color. color = "black"'; foreach ($context['colors'] as $limit => $color) { echo ' if (percent >= ', $limit, ') color = "', $color, '";'; } echo ' document.getElementById(\'warning_progress\').style.backgroundColor = color; // Also set the right effect. effectText = "";'; foreach ($context['level_effects'] as $limit => $text) { echo ' if (percent >= ', $limit, ') effectText = "', $text, '";'; } echo ' setInnerHTML(document.getElementById(\'cur_level_div\'), effectText); } // Disable notification boxes as required. function modifyWarnNotify() { disable = !document.getElementById(\'warn_notify\').checked; document.getElementById(\'warn_sub\').disabled = disable; document.getElementById(\'warn_body\').disabled = disable; document.getElementById(\'warn_temp\').disabled = disable; document.getElementById(\'new_template_link\').style.display = disable ? \'none\' : \'\'; document.getElementById(\'preview_button\').style.display = disable ? \'none\' : \'\'; } function changeWarnLevel(amount) { setWarningBarPos(false, false, amount); } // Warn template. function populateNotifyTemplate() { index = document.getElementById(\'warn_temp\').value; if (index == -1) return false; // Otherwise see what we can do...'; foreach ($context['notification_templates'] as $k => $type) { echo ' if (index == ', $k, ') document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";'; } echo ' } // ]]></script>'; echo ' <form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=issuewarning" method="post" class="flow_hidden" accept-charset="', $context['character_set'], '"> <div class="cat_bar"> <h3 class="catbg"> <img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" /> ', $context['user']['is_owner'] ? $txt['profile_warning_level'] : $txt['profile_issue_warning'], ' </h3> </div>'; if (!$context['user']['is_owner']) { echo ' <p class="description">', $txt['profile_warning_desc'], '</p>'; } echo ' <div class="windowbg"> <div class="content"> <dl class="settings">'; if (!$context['user']['is_owner']) { echo ' <dt> <strong>', $txt['profile_warning_name'], ':</strong> </dt> <dd> <strong>', $context['member']['name'], '</strong> </dd>'; } echo ' <dt> <strong>', $txt['profile_warning_level'], ':</strong>'; // Is there only so much they can apply? if ($context['warning_limit']) { echo ' <br /><span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>'; } echo ' </dt> <dd> <div id="warndiv1" style="display: none;"> <div> <span class="floatleft" style="padding: 0 0.5em"><a href="#" onclick="changeWarnLevel(-5); return false;">[-]</a></span> <div class="floatleft" id="warning_contain" style="font-size: 8pt; height: 12pt; width: ', $context['warningBarWidth'], 'px; border: 1px solid black; background-color: white; padding: 1px; position: relative;" onmousedown="setWarningBarPos(event, true);" onmousemove="setWarningBarPos(event, true);" onclick="setWarningBarPos(event);"> <div id="warning_text" style="padding-top: 1pt; width: 100%; z-index: 2; color: black; position: absolute; text-align: center; font-weight: bold;">', $context['member']['warning'], '%</div> <div id="warning_progress" style="width: ', $context['member']['warning'], '%; height: 12pt; z-index: 1; background-color: ', $context['current_color'], ';"> </div> </div> <span class="floatleft" style="padding: 0 0.5em"><a href="#" onclick="changeWarnLevel(5); return false;">[+]</a></span> <div class="clear_left smalltext">', $txt['profile_warning_impact'], ': <span id="cur_level_div">', $context['level_effects'][$context['current_level']], '</span></div> </div> <input type="hidden" name="warning_level" id="warning_level" value="SAME" /> </div> <div id="warndiv2"> <input type="text" name="warning_level_nojs" size="6" maxlength="4" value="', $context['member']['warning'], '" class="input_text" /> ', $txt['profile_warning_max'], ' <div class="smalltext">', $txt['profile_warning_impact'], ':<br />'; // For non-javascript give a better list. foreach ($context['level_effects'] as $limit => $effect) { echo ' ', sprintf($txt['profile_warning_effect_text'], $limit, $effect), '<br />'; } echo ' </div> </div> </dd>'; if (!$context['user']['is_owner']) { echo ' <dt> <strong>', $txt['profile_warning_reason'], ':</strong><br /> <span class="smalltext">', $txt['profile_warning_reason_desc'], '</span> </dt> <dd> <input type="text" name="warn_reason" id="warn_reason" value="', $context['warning_data']['reason'], '" size="50" style="width: 80%;" class="input_text" /> </dd> </dl> <hr /> <div id="box_preview"', !empty($context['warning_data']['body_preview']) ? '' : ' style="display:none"', '> <dl class="settings"> <dt> <strong>', $txt['preview'], '</strong> </dt> <dd id="body_preview"> ', !empty($context['warning_data']['body_preview']) ? $context['warning_data']['body_preview'] : '', ' </dd> </dl> <hr /> </div> <dl class="settings"> <dt> <strong><label for="warn_notify">', $txt['profile_warning_notify'], ':</label></strong> </dt> <dd> <input type="checkbox" name="warn_notify" id="warn_notify" onclick="modifyWarnNotify();" ', $context['warning_data']['notify'] ? 'checked="checked"' : '', ' class="input_check" /> </dd> <dt> <strong><label for="warn_sub">', $txt['profile_warning_notify_subject'], ':</label></strong> </dt> <dd> <input type="text" name="warn_sub" id="warn_sub" value="', empty($context['warning_data']['notify_subject']) ? $txt['profile_warning_notify_template_subject'] : $context['warning_data']['notify_subject'], '" size="50" style="width: 80%;" class="input_text" /> </dd> <dt> <strong><label for="warn_temp">', $txt['profile_warning_notify_body'], ':</label></strong> </dt> <dd> <select name="warn_temp" id="warn_temp" disabled="disabled" onchange="populateNotifyTemplate();" style="font-size: x-small;"> <option value="-1">', $txt['profile_warning_notify_template'], '</option> <option value="-1">------------------------------</option>'; foreach ($context['notification_templates'] as $id_template => $template) { echo ' <option value="', $id_template, '">', $template['title'], '</option>'; } echo ' </select> <span class="smalltext" id="new_template_link" style="display: none;">[<a href="', $scripturl, '?action=moderate;area=warnings;sa=templateedit;tid=0" target="_blank" class="new_win">', $txt['profile_warning_new_template'], '</a>]</span><br /> <textarea name="warn_body" id="warn_body" cols="40" rows="8" style="min-width: 50%; max-width: 99%;">', $context['warning_data']['notify_body'], '</textarea> </dd>'; } echo ' </dl> <div class="righttext">'; if (!empty($context['token_check'])) { echo ' <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />'; } echo ' <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> <input type="submit" name="preview" id="preview_button" value="', $txt['preview'], '" class="button_submit" /> <input type="submit" name="save" value="', $context['user']['is_owner'] ? $txt['change_profile'] : $txt['profile_warning_issue'], '" class="button_submit" /> </div> </div> </div> </form>'; // Previous warnings? template_show_list('view_warnings'); // Do our best to get pretty javascript enabled. echo ' <script type="text/javascript"><!-- // --><![CDATA[ document.getElementById(\'warndiv1\').style.display = ""; document.getElementById(\'preview_button\').style.display = "none"; document.getElementById(\'warndiv2\').style.display = "none";'; if (!$context['user']['is_owner']) { echo ' modifyWarnNotify(); $(document).ready(function() { $("#preview_button").click(function() { return ajax_getTemplatePreview(); }); }); function ajax_getTemplatePreview () { $.ajax({ type: "POST", url: "' . $scripturl . '?action=xmlhttp;sa=previews;xml", data: {item: "warning_preview", title: $("#warn_sub").val(), body: $("#warn_body").val(), issuing: true}, context: document.body, success: function(request){ $("#box_preview").css({display:""}); $("#body_preview").html($(request).find(\'body\').text()); if ($(request).find("error").text() != \'\') { $("#profile_error").css({display:""}); var errors_html = \'<span>\' + $("#profile_error").find("span").html() + \'</span>\' + \'<ul class="list_errors" class="reset">\'; var errors = $(request).find(\'error\').each(function() { errors_html += \'<li>\' + $(this).text() + \'</li>\'; }); errors_html += \'</ul>\'; $("#profile_error").html(errors_html); } else { $("#profile_error").css({display:"none"}); $("#error_list").html(\'\'); } return false; }, }); return false; }'; } echo ' // ]]></script>'; }
/** * Show all warnings of a user */ function template_viewWarning() { global $context, $txt; template_load_warning_variables(); echo ' <h2 class="category_header hdicon cat_img_profile"> ', sprintf($txt['profile_viewwarning_for_user'], $context['member']['name']), ' </h2> <p class="description">', $txt['viewWarning_help'], '</p> <div class="windowbg"> <div class="content"> <dl class="settings"> <dt> <strong>', $txt['profile_warning_name'], ':</strong> </dt> <dd> ', $context['member']['name'], ' </dd> <dt> <strong>', $txt['profile_warning_level'], ':</strong> </dt> <dd> <div> <div> <div style="font-size: 8pt; height: 12pt; width: ', $context['warningBarWidth'], 'px; border: 1px solid black; background: white; padding: 1px; position: relative;"> <div id="warning_text" class="centertext">', $context['member']['warning'], '%</div> <div id="warning_progress" style="width: ', $context['member']['warning'], '%; height: 12pt; z-index: 1; background: ', $context['current_color'], ';"> </div> </div> </div> </div> </dd>'; // There's some impact of this? if (!empty($context['level_effects'][$context['current_level']])) { echo ' <dt> <strong>', $txt['profile_viewwarning_impact'], ':</strong> </dt> <dd> ', $context['level_effects'][$context['current_level']], ' </dd>'; } echo ' </dl> </div> </div>'; template_show_list('view_warnings'); }
function template_issueWarning() { global $context, $settings, $options, $scripturl, $modSettings, $txt; template_load_warning_variables(); echo ' <script type="text/javascript"><!-- // --><![CDATA[ function setWarningBarPos(curEvent, isMove, changeAmount) { barWidth = ', $context['warningBarWidth'], '; // Are we passing the amount to change it by? if (changeAmount) { if (document.getElementById(\'warning_level\').value == \'SAME\') percent = ', $context['member']['warning'], ' + changeAmount; else percent = parseInt(document.getElementById(\'warning_level\').value) + changeAmount; } // If not then it\'s a mouse thing. else { if (!curEvent) var curEvent = window.event; // If it\'s a movement check the button state first! if (isMove) { if (!curEvent.button || curEvent.button != 1) return false } // Get the position of the container. contain = document.getElementById(\'warning_contain\'); position = 0; while (contain != null) { position += contain.offsetLeft; contain = contain.offsetParent; } // Where is the mouse? if (curEvent.pageX) { mouse = curEvent.pageX; } else { mouse = curEvent.clientX; mouse += document.documentElement.scrollLeft != "undefined" ? document.documentElement.scrollLeft : document.body.scrollLeft; } // Is this within bounds? if (mouse < position || mouse > position + barWidth) return; percent = Math.round(((mouse - position) / barWidth) * 100); // Round percent to the nearest 5 - by kinda cheating! percent = Math.round(percent / 5) * 5; } // What are the limits? minLimit = ', $context['min_allowed'], '; maxLimit = ', $context['max_allowed'], '; percent = Math.max(percent, minLimit); percent = Math.min(percent, maxLimit); size = barWidth * (percent/100); setInnerHTML(document.getElementById(\'warning_text\'), percent + "%"); document.getElementById(\'warning_level\').value = percent; document.getElementById(\'warning_progress\').style.width = size + "px"; // Get the right color. color = "black"'; foreach ($context['colors'] as $limit => $color) { echo ' if (percent >= ', $limit, ') color = "', $color, '";'; } echo ' document.getElementById(\'warning_progress\').style.backgroundColor = color; // Also set the right effect. effectText = "";'; foreach ($context['level_effects'] as $limit => $text) { echo ' if (percent >= ', $limit, ') effectText = "', $text, '";'; } echo ' setInnerHTML(document.getElementById(\'cur_level_div\'), effectText); } // Disable notification boxes as required. function modifyWarnNotify() { disable = !document.getElementById(\'warn_notify\').checked; document.getElementById(\'warn_sub\').disabled = disable; document.getElementById(\'warn_body\').disabled = disable; document.getElementById(\'warn_temp\').disabled = disable; document.getElementById(\'new_template_link\').style.display = disable ? \'none\' : \'\'; } function changeWarnLevel(amount) { setWarningBarPos(false, false, amount); } // Warn template. function populateNotifyTemplate() { index = document.getElementById(\'warn_temp\').value; if (index == -1) return false; // Otherwise see what we can do...'; foreach ($context['notification_templates'] as $k => $type) { echo ' if (index == ', $k, ') document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";'; } echo ' } // ]]></script>'; echo ' <form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=issuewarning" method="post" class="flow_hidden" accept-charset="', $context['character_set'], '"> <div class="cat_bar"> <h3 class="catbg"> <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.gif" alt="" class="icon" /> ', $context['user']['is_owner'] ? $txt['profile_warning_level'] : $txt['profile_issue_warning'], ' </span> </h3> </div>'; if (!$context['user']['is_owner']) { echo ' <p class="description">', $txt['profile_warning_desc'], '</p>'; } echo ' <div class="windowbg"> <span class="topslice"><span></span></span> <div class="content"> <dl class="settings">'; if (!$context['user']['is_owner']) { echo ' <dt> <strong>', $txt['profile_warning_name'], ':</strong> </dt> <dd> <strong>', $context['member']['name'], '</strong> </dd>'; } echo ' <dt> <strong>', $txt['profile_warning_level'], ':</strong>'; // Is there only so much they can apply? if ($context['warning_limit']) { echo ' <br /><span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>'; } echo ' </dt> <dd> <div id="warndiv1" style="display: none;"> <div> <span class="floatleft" style="padding: 0 0.5em"><a href="#" onclick="changeWarnLevel(-5); return false;">[-]</a></span> <div class="floatleft" id="warning_contain" style="font-size: 8pt; height: 12pt; width: ', $context['warningBarWidth'], 'px; border: 1px solid black; background-color: white; padding: 1px; position: relative;" onmousedown="setWarningBarPos(event, true);" onmousemove="setWarningBarPos(event, true);" onclick="setWarningBarPos(event);"> <div id="warning_text" style="padding-top: 1pt; width: 100%; z-index: 2; color: black; position: absolute; text-align: center; font-weight: bold;">', $context['member']['warning'], '%</div> <div id="warning_progress" style="width: ', $context['member']['warning'], '%; height: 12pt; z-index: 1; background-color: ', $context['current_color'], ';"> </div> </div> <span class="floatleft" style="padding: 0 0.5em"><a href="#" onclick="changeWarnLevel(5); return false;">[+]</a></span> <div class="clear_left smalltext">', $txt['profile_warning_impact'], ': <span id="cur_level_div">', $context['level_effects'][$context['current_level']], '</span></div> </div> <input type="hidden" name="warning_level" id="warning_level" value="SAME" /> </div> <div id="warndiv2"> <input type="text" name="warning_level_nojs" size="6" maxlength="4" value="', $context['member']['warning'], '" class="input_text" /> ', $txt['profile_warning_max'], ' <div class="smalltext">', $txt['profile_warning_impact'], ':<br />'; // For non-javascript give a better list. foreach ($context['level_effects'] as $limit => $effect) { echo ' ', sprintf($txt['profile_warning_effect_text'], $limit, $effect), '<br />'; } echo ' </div> </div> </dd>'; if (!$context['user']['is_owner']) { echo ' <dt> <strong>', $txt['profile_warning_reason'], ':</strong><br /> <span class="smalltext">', $txt['profile_warning_reason_desc'], '</span> </dt> <dd> <input type="text" name="warn_reason" id="warn_reason" value="', $context['warning_data']['reason'], '" size="50" style="width: 80%;" class="input_text" /> </dd> </dl> <hr /> <dl class="settings"> <dt> <strong>', $txt['profile_warning_notify'], ':</strong> </dt> <dd> <input type="checkbox" name="warn_notify" id="warn_notify" onclick="modifyWarnNotify();" ', $context['warning_data']['notify'] ? 'checked="checked"' : '', ' class="input_check" /> </dd> <dt> <strong>', $txt['profile_warning_notify_subject'], ':</strong> </dt> <dd> <input type="text" name="warn_sub" id="warn_sub" value="', empty($context['warning_data']['notify_subject']) ? $txt['profile_warning_notify_template_subject'] : $context['warning_data']['notify_subject'], '" size="50" style="width: 80%;" class="input_text" /> </dd> <dt> <strong>', $txt['profile_warning_notify_body'], ':</strong> </dt> <dd> <select name="warn_temp" id="warn_temp" disabled="disabled" onchange="populateNotifyTemplate();" style="font-size: x-small;"> <option value="-1">', $txt['profile_warning_notify_template'], '</option> <option value="-1">------------------------------</option>'; foreach ($context['notification_templates'] as $id_template => $template) { echo ' <option value="', $id_template, '">', $template['title'], '</option>'; } echo ' </select> <span class="smalltext" id="new_template_link" style="display: none;">[<a href="', $scripturl, '?action=moderate;area=warnings;sa=templateedit;tid=0" target="_blank" class="new_win">', $txt['profile_warning_new_template'], '</a>]</span><br /> <textarea name="warn_body" id="warn_body" cols="40" rows="8">', $context['warning_data']['notify_body'], '</textarea> </dd>'; } echo ' </dl> <div class="righttext"> <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> <input type="submit" name="save" value="', $context['user']['is_owner'] ? $txt['change_profile'] : $txt['profile_warning_issue'], '" class="button_submit" /> </div> </div> <span class="botslice"><span></span></span> </div> </form>'; // Previous warnings? echo '<br /> <div class="cat_bar"> <h3 class="catbg"> ', $txt['profile_warning_previous'], ' </h3> </div> <table border="0" width="100%" cellspacing="0" cellpadding="5" class="table_grid"> <thead> <tr class="titlebg lefttext"> <th class="first_th" scope="col" width="20%">', $txt['profile_warning_previous_issued'], '</th> <th scope="col" width="30%">', $txt['profile_warning_previous_time'], '</th> <th scope="col">', $txt['profile_warning_previous_reason'], '</th> <th class="last_th" scope="col" width="6%">', $txt['profile_warning_previous_level'], '</th> </tr> </thead> <tbody>'; // Print the warnings. $alternate = 0; foreach ($context['previous_warnings'] as $warning) { $alternate = !$alternate; echo ' <tr class="', $alternate ? 'windowbg' : 'windowbg2', '"> <td class="smalltext">', $warning['issuer']['link'], '</td> <td class="smalltext">', $warning['time'], '</td> <td class="smalltext"> <div class="floatleft"> ', $warning['reason'], ' </div>'; if (!empty($warning['id_notice'])) { echo ' <div class="floatright"> <a href="', $scripturl, '?action=moderate;area=notice;nid=', $warning['id_notice'], '" onclick="window.open(this.href, \'\', \'scrollbars=yes,resizable=yes,width=400,height=250\');return false;" target="_blank" class="new_win" title="', $txt['profile_warning_previous_notice'], '"><img src="', $settings['images_url'], '/filter.gif" alt="" /></a> </div>'; } echo ' </td> <td class="smalltext">', $warning['counter'], '</td> </tr>'; } if (empty($context['previous_warnings'])) { echo ' <tr class="windowbg2"> <td align="center" colspan="4"> ', $txt['profile_warning_previous_none'], ' </td> </tr>'; } echo ' </tbody> </table> <div class="pagesection">', $txt['pages'], ': ', $context['page_index'], '</div>'; // Do our best to get pretty javascript enabled. echo ' <script type="text/javascript"><!-- // --><![CDATA[ document.getElementById(\'warndiv1\').style.display = ""; document.getElementById(\'warndiv2\').style.display = "none";'; if (!$context['user']['is_owner']) { echo ' modifyWarnNotify();'; } echo ' // ]]></script>'; }
/** * Show a lovely interface for issuing warnings. */ function template_issueWarning() { global $context, $scripturl, $txt; template_load_warning_variables(); echo ' <script><!-- // --><![CDATA[ var barWidth = ', $context['warningBarWidth'], ', currentLevel = ', $context['member']['warning'], ', minLimit = ', $context['min_allowed'], ', maxLimit = ', $context['max_allowed'], ', color = "black", effectText = ""; // Colors for the warning level var colors = {'; foreach ($context['colors'] as $limit => $color) { echo $limit, ' : "', $color, '", '; } echo '}; // Text to describe the effect of the chosen level var effectTexts = {'; foreach ($context['level_effects'] as $limit => $text) { echo $limit, ' : "', $text, '", '; } echo '} // Warning templates that can be sent to the user var templates = {'; foreach ($context['notification_templates'] as $limit => $type) { echo $limit, ' :"', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '", '; } echo '}; // ]]></script>'; echo ' <form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=issuewarning" method="post" class="flow_hidden" accept-charset="UTF-8"> <h3 class="category_header hdicon cat_img_profile"> ', $context['user']['is_owner'] ? $txt['profile_warning_level'] : $txt['profile_issue_warning'], ' </h3>'; if (!$context['user']['is_owner']) { echo ' <p class="description">', $txt['profile_warning_desc'], '</p>'; } echo ' <div class="windowbg"> <div class="content"> <dl class="settings">'; if (!$context['user']['is_owner']) { echo ' <dt> <strong>', $txt['profile_warning_name'], ':</strong> </dt> <dd> <strong>', $context['member']['name'], '</strong> </dd>'; } echo ' <dt> <strong><label for="warning_level">', $txt['profile_warning_level'], '</label>:</strong> <div class="smalltext">', $txt['profile_warning_impact'], ':<br />'; // For non-javascript give a better list. foreach ($context['level_effects'] as $limit => $effect) { echo ' ', sprintf($txt['profile_warning_effect_text'], $limit, $effect), '<br />'; } echo ' </div>'; // Is there only so much they can apply? if ($context['warning_limit']) { echo ' <br /><span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>'; } echo ' </dt> <dd> <div id="warndiv"> <input type="text" id="warning_level" name="warning_level" size="6" maxlength="4" value="', $context['member']['warning'], '" class="input_text" /> ', $txt['profile_warning_max'], ' <div id="slider-range-min"></div> <script><!-- // --><![CDATA[ initWarnSlider("slider-range-min", "warning_level", [', implode(',', array_keys($context['level_effects'])), ']); // ]]></script> </div> </dd>'; if (!$context['user']['is_owner']) { echo ' <dt> <strong><label for="warn_reason">', $txt['profile_warning_reason'], '</label>:</strong><br /> <span class="smalltext">', $txt['profile_warning_reason_desc'], '</span> </dt> <dd> <input type="text" name="warn_reason" id="warn_reason" value="', $context['warning_data']['reason'], '" size="50" style="width: 80%;" class="input_text" /> </dd> </dl> <hr /> <div id="box_preview"', !empty($context['warning_data']['body_preview']) ? '' : ' style="display:none"', '> <dl class="settings"> <dt> <strong>', $txt['preview'], '</strong> </dt> <dd id="body_preview"> ', !empty($context['warning_data']['body_preview']) ? $context['warning_data']['body_preview'] : '', ' </dd> </dl> <hr /> </div> <dl class="settings"> <dt> <strong><label for="warn_notify">', $txt['profile_warning_notify'], ':</label></strong> </dt> <dd> <input type="checkbox" name="warn_notify" id="warn_notify" onclick="modifyWarnNotify();" ', $context['warning_data']['notify'] ? 'checked="checked"' : '', ' class="input_check" /> </dd> <dt> <strong><label for="warn_sub">', $txt['profile_warning_notify_subject'], ':</label></strong> </dt> <dd> <input type="text" name="warn_sub" id="warn_sub" value="', empty($context['warning_data']['notify_subject']) ? $txt['profile_warning_notify_template_subject'] : $context['warning_data']['notify_subject'], '" size="50" style="width: 80%;" class="input_text" /> </dd> <dt> <strong><label for="warn_temp">', $txt['profile_warning_notify_body'], ':</label></strong> </dt> <dd> <div class="padding"> <select name="warn_temp" id="warn_temp" disabled="disabled" onchange="populateNotifyTemplate();"> <option value="-1">', $txt['profile_warning_notify_template'], '</option> <option value="-1" disabled="disabled">', str_repeat('—', strlen($txt['profile_warning_notify_template'])), '</option>'; foreach ($context['notification_templates'] as $id_template => $template) { echo ' <option value="', $id_template, '">' . (isBrowser('ie8') ? '»' : '➤') . ' ', $template['title'], '</option>'; } echo ' </select> <span id="new_template_link" style="display: none;"><a class="linkbutton new_win" href="', $scripturl, '?action=moderate;area=warnings;sa=templateedit;tid=0" target="_blank">', $txt['profile_warning_new_template'], '</a></span> </div> <textarea name="warn_body" id="warn_body" cols="40" rows="8" style="min-width: 50%; max-width: 99%;">', $context['warning_data']['notify_body'], '</textarea> </dd>'; } echo ' </dl> <div class="submitbutton">'; if (!empty($context['token_check'])) { echo ' <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />'; } echo ' <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> <input type="submit" name="save" value="', $context['user']['is_owner'] ? $txt['change_profile'] : $txt['profile_warning_issue'], '" class="button_submit" /> <input type="submit" name="preview" id="preview_button" value="', $txt['preview'], '" class="button_submit" /> </div> </div> </div> </form> <br />'; // Previous warnings? template_show_list('issued_warnings'); // Do our best to get pretty javascript enabled. echo ' <script><!-- // --><![CDATA[ document.getElementById(\'preview_button\').style.display = "none";'; if (!$context['user']['is_owner']) { echo ' modifyWarnNotify();'; } echo ' // ]]></script>'; }