Empty commit

This commit is contained in:
Git 2013-09-02 08:00:37 +00:00
parent 25bf6fe0e9
commit f269fa5454
8 changed files with 114 additions and 6 deletions

View File

@ -28,10 +28,10 @@
</p>
<? } ?>
<p>
<strong>Time:</strong> <?=number_format(((microtime(true) - $ScriptStartTime) * 1000), 5)?> ms
<strong>Used:</strong> <?=Format::get_size(memory_get_usage(true))?>
<strong>Load:</strong> <?=number_format($Load[0], 2).' '.number_format($Load[1], 2).' '.number_format($Load[2], 2)?>
<strong>Date:</strong> <?=date('M d Y, H:i')?>
<strong>Time:</strong> <span><?=number_format(((microtime(true) - $ScriptStartTime) * 1000), 5)?> ms</span>
<strong>Used:</strong> <span><?=Format::get_size(memory_get_usage(true))?></span>
<strong>Load:</strong> <span><?=number_format($Load[0], 2).' '.number_format($Load[1], 2).' '.number_format($Load[2], 2)?></span>
<strong>Date:</strong> <span><?=date('M d Y, H:i')?></span>
</p>
</div>

View File

@ -1,5 +1,8 @@
CHANGELOG
2013-09-01 by Ajax
Tool for staff to send mass PMs to primary and secondary classes
2013-08-28 by porkpie
Add an option for the styled tooltips

View File

@ -497,6 +497,12 @@
case 'take_calendar_event':
include('managers/ajax_take_calendar_event.php');
break;
case 'mass_pm':
include('managers/mass_pm.php');
break;
case 'take_mass_pm':
include('managers/take_mass_pm.php');
break;
default:
include(SERVER_ROOT.'/sections/tools/tools.php');
}

View File

@ -0,0 +1,47 @@
<?
if (!check_perms("users_mod")) {
error(403);
}
$Classes = Users::get_classes()[0];
// If your user base is large, sending a PM to the lower classes will take a long time
// add the class ID into this array to skip it when presenting the list of classes
$SkipClassIDs = array(USER, MEMBER, POWER, ELITE, TORRENT_MASTER, DONOR, POWER_TM, ELITE_TM);
View::show_header('Compose Mass PM', 'inbox,bbcode,jquery.validate,form_validate');
?>
<div class="thin">
<div class="header">
<h2>Send a mass PM</h2>
</div>
<form class="send_form" name="message" action="tools.php" method="post" id="messageform">
<div class="box pad">
<input type="hidden" name="action" value="take_mass_pm" />
<input type="hidden" name="auth" value="<?=G::$LoggedUser['AuthKey']?>" />
<div id="quickpost">
<h3>Class</h3>
<select id="class_id" name="class_id">
<option>---</option>
<? foreach ($Classes as $Class) {
if (!in_array($Class['ID'], $SkipClassIDs)) { ?>
<option value="<?=$Class['ID']?>"><?=$Class['Name']?></option>
<? }
} ?>
</select>
<h3>Subject</h3>
<input type="text" class="required" name="subject" size="95" /><br />
<h3>Body</h3>
<textarea id="body" class="required" name="body" cols="95" rows="10" onkeyup="resize('body')"></textarea>
</div>
<input type="checkbox" name="from_system" id="from_system" />Send as System
<div id="preview" class="hidden"></div>
<div id="buttons" class="center">
<input type="button" value="Preview" onclick="Quick_Preview();" />
<input type="submit" value="Send message" />
</div>
</div>
</form>
</div>
<?
View::show_footer();
?>

View File

@ -0,0 +1,28 @@
<?
set_time_limit(0);
authorize();
if (!check_perms("users_mod")) {
error(403);
}
if (!is_number($_POST['class_id']) || empty($_POST['subject']) || empty($_POST['body'])) {
error("Error in message form");
}
$PermissionID = $_POST['class_id'];
$Subject = $_POST['subject'];
$Body = $_POST['body'];
$FromID = empty($_POST['from_system']) ? G::$LoggedUser['ID'] : 0;
G::$DB->query("
(SELECT ID AS UserID FROM users_main WHERE PermissionID = '$PermissionID' AND ID != '$FromID') UNION (SELECT UserID FROM users_levels WHERE PermissionID = '$PermissionID' AND UserID != '$FromID')");
while(list($UserID) = G::$DB->next_record()) {
Misc::send_pm($UserID, $FromID, $Subject, $Body);
}
header("Location: tools.php");

View File

@ -38,7 +38,10 @@
<tr><td><a href="tools.php?action=global_notification">Global Notification</a></td></tr>
<? } if (Calendar::can_view()) { ?>
<tr><td><a href="tools.php?action=calendar">Calendar</a></td></tr>
<? } ?>
<? } if (check_perms('users_mod')) { ?>
<tr><td><a href="tools.php?action=mass_pm">Mass PM</a></td></tr>
<? } ?>
</table>
</div>
<div class="permission_container">

View File

@ -36,6 +36,9 @@ $(document).ready(function() {
if (query['action'] == "calendar") {
$("#event_form").validate();
}
if (query['action'] == "mass_pm") {
$("#messageform").validate();
}
break;
default:
break;

View File

@ -180,6 +180,7 @@
that.el.on('blur.autocomplete', function () { that.onBlur(); });
that.el.on('focus.autocomplete', function () { that.fixPosition(); });
that.el.on('change.autocomplete', function (e) { that.onKeyUp(e); });
that.el.on('paste.autocomplete', function () { that.onPaste(); });
},
onBlur: function () {
@ -355,7 +356,7 @@
that.findBestHint();
if (that.options.deferRequestBy > 0) {
// Defer lookup in case when value changes very quickly:
that.onChangeInterval = setInterval(function () {
that.onChangeInterval = setTimeout(function () {
that.onValueChange();
}, that.options.deferRequestBy);
} else {
@ -364,6 +365,23 @@
}
},
onPaste: function () {
var that = this;
if (that.disabled) {
return;
}
clearInterval(that.onChangeInterval);
setTimeout(function () {
if (that.currentValue !== that.el.val()) {
that.findBestHint();
that.onValueChange();
}
}, 100);
},
onValueChange: function () {
var that = this,
q;