mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-08 00:21:59 +01:00
prototype of message removal
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
parent
ea3b0c372b
commit
4b2eefb712
@ -7,14 +7,14 @@ class ControllerAuditRemoval extends Controller {
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "audit/removal.tpl";
|
||||
$this->layout = "common/layout-audit";
|
||||
$this->layout = "common/layout";
|
||||
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
||||
$this->load->model('audit/removal');
|
||||
|
||||
if(Registry::get('admin_user') == 0 && Registry::get('auditor_user') == 0) {
|
||||
if(Registry::get('admin_user') == 0 && Registry::get('auditor_user') == 0 && Registry::get('data_officer') == 0) {
|
||||
die("go away");
|
||||
}
|
||||
|
||||
|
51
webui/controller/message/remove.php
Normal file
51
webui/controller/message/remove.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ControllerMessageRemove extends Controller {
|
||||
|
||||
public function index(){
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "message/bulkremove.tpl";
|
||||
$this->layout = "common/layout-empty";
|
||||
|
||||
$session = Registry::get('session');
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
||||
$this->load->model('search/search');
|
||||
$this->load->model('search/message');
|
||||
$this->load->model('user/user');
|
||||
|
||||
$this->document->title = $this->data['text_message'];
|
||||
|
||||
if(!isset($this->request->get['id']) || $this->request->get['id'] == '') { die("no id parameter given"); }
|
||||
if(!isset($this->request->get['confirmed']) || $this->request->get['confirmed'] != 1) { die("not confirmed"); }
|
||||
|
||||
$id = (int)$this->request->get['id'];
|
||||
|
||||
// FIXME: For the moment data officer has no permission to see the message
|
||||
if(!$this->model_search_search->check_your_permission_by_id($id)) {
|
||||
die("no permission for $id");
|
||||
}
|
||||
|
||||
$this->data['username'] = Registry::get('username');
|
||||
|
||||
if(Registry::get('data_officer') == 0) {
|
||||
die("go away");
|
||||
}
|
||||
|
||||
// Shouldn't we ask for a token or something as well?
|
||||
|
||||
AUDIT(ACTION_REMOVE_MESSAGE, '', '', $id, '');
|
||||
$db->query("UPDATE " . TABLE_META . " SET retained=? WHERE id=?", [NOW, $id]);
|
||||
$db->query("UPDATE " . TABLE_DELETED . " SET deleted=1 WHERE id=?", [$id]);
|
||||
syslog(LOG_INFO, $this->data['username'] . " removed message: $id");
|
||||
|
||||
$this->data['x'] = $this->data['text_successfully_removed'];
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,5 +1,16 @@
|
||||
<div id="sspinner" class="alert alert-info lead"><i class="icon-spinner icon-spin icon-2x pull-left"></i><?php print $text_working; ?></div>
|
||||
<div id="resultscontainer" class="boxlistcontent<?php if($n <= 0) { ?> empty<?php } ?>" >
|
||||
<div id="deleteconfirm-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>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Remove message <span id="name">ERROR</span>?</p>
|
||||
</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&id=Error&confirmed=0" class="btn btn-primary" id="id"><?php print $text_delete; ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table id="resultstable" class="table table-striped table-condensed">
|
||||
<thead id="resultstop">
|
||||
@ -25,7 +36,9 @@
|
||||
<th class="auditcell ref header">
|
||||
<?php print $text_ref; ?>
|
||||
</th>
|
||||
|
||||
<th class="auditcell removal header">
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@ -38,14 +51,10 @@
|
||||
<td class="auditcell date"><?php print $d['deleted']; ?></td>
|
||||
<td class="auditcell ip"><?php print $d['reason']; ?></td>
|
||||
<td class="auditcell ref"><?php if($d['deleted'] == 0) { ?><a href="#" onclick="Piler.view_message(<?php print $d['id']; ?>);"><?php } print $d['id']; if($d['deleted'] == 0) { ?></a><?php } ?></td>
|
||||
<td class="auditcell aaa"><a href="#" class="confirm-delete" data-id="<?php print $d['id']; ?>" data-name="<?php print $d['id']; ?>"><i class="icon-remove-sign"></i> <?php print $text_remove; ?></a></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!--div id="messagelistfooter" class="boxfooter">
|
||||
</div-->
|
||||
|
6
webui/view/theme/default/templates/audit/remove.tpl
Normal file
6
webui/view/theme/default/templates/audit/remove.tpl
Normal file
@ -0,0 +1,6 @@
|
||||
<div>
|
||||
|
||||
<div class="alert alert-success"><?php print $x; ?>.</div>
|
||||
<p><a href="index.php?route=audit/removal"><i class="icon-circle-arrow-left"></i> <?php print $text_back; ?></a></p>
|
||||
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user