More fixes to gdpr

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2019-08-20 21:08:59 +02:00
parent 3550987087
commit 23697125ed
4 changed files with 46 additions and 9 deletions

View File

@ -37,7 +37,7 @@ class ControllerMessageRejectRemove extends Controller {
// Shouldn't we ask for a token or something as well?
$db->query("UPDATE " . TABLE_DELETED . " SET deleted=0, date2=?, reason2=? WHERE id=?", [NOW, $this->request->post['reason2'], $id]);
$db->query("UPDATE " . TABLE_DELETED . " SET deleted=0, approver=?, date2=?, reason2=? WHERE id=?", [$this->data['username'], NOW, $this->request->post['reason2'], $id]);
syslog(LOG_INFO, $this->data['username'] . " rejected removing message: $id");
$this->render();

View File

@ -524,7 +524,7 @@ class ModelSearchSearch extends Model {
}
if(ENABLE_DELETE) {
$s = $this->db->query("SELECT `id` FROM `" . TABLE_DELETED . "` WHERE id IN ($q)", $ids);
$s = $this->db->query("SELECT `id` FROM `" . TABLE_DELETED . "` WHERE deleted=1 AND id IN ($q)", $ids);
foreach ($s->rows as $p) {
$deleted[$p['id']] = 1;

View File

@ -391,11 +391,11 @@ var Piler =
Piler.poor_mans_keepalive_for_dummy_browsers();
jQuery.ajax('/index.php?route=message/rejectremove', {
jQuery.ajax('/rejectremove.php', {
data: { id: id, confirmed: 1, reason2: reason2 },
type: "POST"
})
.done( function( a ) {})
.done( function( a ) { location.reload(); })
.fail(function( a, b ) { alert("Problem retrieving XML data:" + b) });
$('#delete-rejected-modal').modal('hide')

View File

@ -48,14 +48,19 @@
<div id="delete-rejected-modal" class="modal hide fade">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" role="dialog" aria-hidden="true"><i class="icon-remove"></i></button>
<h3><?php print $text_confirm; ?> <?php print $text_delete; ?></h3>
<h3><?php print $text_reject; ?> <?php print $text_remove_message; ?> <span id="reject_id1"/></h3>
</div>
<div class="modal-body">
<p>Remove message <span id="name">ERROR</span>?</p>
<form id="reject_form1">
<div class="form-group">
<label for="message-text" class="control-label" id="reject_label"><?php print $text_reason_of_rejection; ?>:</label>
<textarea class="form-control" id="reason2"></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal" aria-hidden="true"><?php print $text_close; ?></a>
<a href="index.php?route=message/remove&amp;id=Error&amp;confirmed=0" class="btn btn-primary" id="id"><?php print $text_delete; ?></a>
<a href="#" class="btn btn-primary" id="reject_id2"><?php print $text_delete; ?></a>
</div>
</div>
@ -105,6 +110,38 @@
$('#id1').text(id)
$('#id2').attr('href', 'index.php?route=message/remove&id=' + id + '&confirmed=1')
})
var reject_id
var reject_label_color
var reason2_border
$('#delete-rejected-modal').on('shown.bs.modal', function (event) {
$('#reason2').focus()
var button = $(event.relatedTarget)
reject_id = button.data('id')
$('#reject_id1').text(reject_id)
})
$('#delete-rejected-modal').on('hide.bs.modal', function (event) {
$('#reject_label').css({'color':reject_label_color})
$('#reason2').css({'border':reason2_border})
})
$('#reject_id2').on('click', function() {
var reason2 = $.trim($('#reason2').val());
if(reason2) {
Piler.reject_removing_message(reject_id, reason2)
} else {
reject_label_color = $('#reject_label').css('color')
reason2_border = $('#reason2').css('border')
$('#reject_label').css({'color':'red'})
$('#reason2').css({'border':'1px solid red'})
}
});
</script>
<?php } ?>