Skip to content

Commit

Permalink
Properly localise and improve UX of sending broadcast messages
Browse files Browse the repository at this point in the history
  • Loading branch information
mdziekon committed Jun 25, 2019
1 parent f8e84d8 commit e7d2edf
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 16 deletions.
31 changes: 31 additions & 0 deletions css/admin/massmessage.css
@@ -0,0 +1,31 @@
.t_r {
text-align: right;
}
.t_l {
text-align: left;
}
.p_r {
padding-right: 5px;
}
.p_l {
padding-left: 5px;
}
.pad3 {
padding: 3px;
}
.inv {
visibility: hidden;
}
.invBr {
height: 5px;
}
#textBox {
width: 90%;
height: 100px;
}
#thisReset {
cursor: pointer;
}
.w90p {
width: 90%;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/js/admin/massmessage.cachebuster-1561475785611.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions js/admin/massmessage.js
@@ -0,0 +1,27 @@
/* globals $MaxLength_Text */

$(document).ready(function () {
var CharCounter = $("#charCounter");
var TextBox = $("#textBox");

$("#thisForm").submit(function () {
$("input[type=\"submit\"]", $(this)).prop("disabled", true);
});
TextBox.keydown(function () {
var ThisLength = $(this).val().length;
if (ThisLength > $MaxLength_Text) {
$(this).val($(this).val().substr(0, $MaxLength_Text));
ThisLength = $MaxLength_Text;
}
CharCounter.html(ThisLength);
}).change(function () {
$(this).keydown();
}).keyup(function () {
$(this).keydown();
});
$("#thisReset").click(function () {
TextBox.val("").keydown();
});

TextBox.keydown();
});
7 changes: 7 additions & 0 deletions language/en/admin/massmessage.lang
@@ -1,5 +1,12 @@
<?php

$_Lang['MassMessage_Form_Title'] = 'Message Broadcast';
$_Lang['MassMessage_Form_Subject'] = 'Subject';
$_Lang['MassMessage_Form_Content'] = 'Content';
$_Lang['MassMessage_Form_ContentLimit'] = 'Limit';
$_Lang['MassMessage_Form_Submit'] = 'Send';
$_Lang['MassMessage_Form_Reset'] = 'Clear';

$_Lang['MassMessage_Success'] = 'Mass Admin message has been sent to %s players!';
$_Lang['MassMessage_NoSufficientData'] = 'You did not provide all necessary details!';

Expand Down
7 changes: 7 additions & 0 deletions language/pl/admin/massmessage.lang
@@ -1,5 +1,12 @@
<?php

$_Lang['MassMessage_Form_Title'] = 'Wiadomość Masowa';
$_Lang['MassMessage_Form_Subject'] = 'Temat';
$_Lang['MassMessage_Form_Content'] = 'Treść';
$_Lang['MassMessage_Form_ContentLimit'] = 'Limit';
$_Lang['MassMessage_Form_Submit'] = 'Wyślij';
$_Lang['MassMessage_Form_Reset'] = 'Wyczyść';

$_Lang['MassMessage_Success'] = 'Wiadomość masowa została wysłana do %s użytkowników!';
$_Lang['MassMessage_NoSufficientData'] = 'Nie podano wszystkich danych!';

Expand Down
58 changes: 42 additions & 16 deletions templates/default_template/admin/massmessage_body.tpl
@@ -1,18 +1,44 @@
<script>
var $MaxLength_Text = {FormInsert_MaxSigns};
</script>
<script src="../dist/js/admin/massmessage.cachebuster-1561475785611.min.js" type="text/javascript"></script>
<link href="../dist/css/admin/massmessage.cachebuster-1561475785613.min.css" rel="stylesheet" type="text/css" />
<br><br>
<form action="?mode=change" method="post">
<table width="519">
<tbody>
<tr>
<td class="c" colspan="2">Wiadomość do wszystkich</td>
</tr><tr>
<th>Temat</th>
<th><input name="temat" maxlength="100" size="20" value="" type="text"></th>
</tr><tr>
<th>Tekst (<span id="cntChars">0</span> / 5000 znaków)</th>
<th><textarea name="tresc" cols="40" rows="10" size="100">Wiadomość administracyjna</textarea></th>
</tr><tr>
<th colspan="2"><input value="Wyślij" type="submit"></th>
</tr>
</tbody>
</table>
<form
id="thisForm"
action="?mode=change"
method="post"
>
<table width="519">
<tr>
<td class="c" colspan="2">{MassMessage_Form_Title}</td>
</tr>
<tr>
<th>{MassMessage_Form_Subject}</th>
<th class="pad2">
<input
type="text"
name="subject"
class="pad3 w90p"
maxlength="100"
value=""
/>
</th>
</tr>
<tr>
<th class="pad2">
{MassMessage_Form_Content}<br />
({MassMessage_Form_ContentLimit}: <span id="charCounter">0</span> / {FormInsert_MaxSigns})<br/>
(<a id="thisReset">{MassMessage_Form_Reset}</a>)
</th>
<th class="pad2">
<textarea name="text" id="textBox"></textarea>
</th>
</tr>
<tr>
<th colspan="2" class="pad2">
<input type="submit" value="{MassMessage_Form_Submit}" class="pad3" style="font-weight: 700; width: 150px;"/>
</th>
</tr>
</table>
</form>

0 comments on commit e7d2edf

Please sign in to comment.