admin log
This commit is contained in:
@@ -830,6 +830,10 @@
|
|||||||
<default key="_controller">Thelia\Controller\Admin\AdminLogsController::defaultAction</default>
|
<default key="_controller">Thelia\Controller\Admin\AdminLogsController::defaultAction</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
<route id="admin.configuration.admin-logs.logger" path="/admin/configuration/adminLogs/logger">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\AdminLogsController::loadLoggerAjaxAction</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
<!-- end admin logs display -->
|
<!-- end admin logs display -->
|
||||||
|
|
||||||
<!-- feature and features value management -->
|
<!-- feature and features value management -->
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
namespace Thelia\Controller\Admin;
|
namespace Thelia\Controller\Admin;
|
||||||
|
|
||||||
use Thelia\Core\Security\AccessManager;
|
use Thelia\Core\Security\AccessManager;
|
||||||
|
use Thelia\Model\AdminLogQuery;
|
||||||
|
|
||||||
class AdminLogsController extends BaseAdminController
|
class AdminLogsController extends BaseAdminController
|
||||||
{
|
{
|
||||||
@@ -36,4 +37,34 @@ class AdminLogsController extends BaseAdminController
|
|||||||
// Render the edition template.
|
// Render the edition template.
|
||||||
return $this->render('admin-logs');
|
return $this->render('admin-logs');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function loadLoggerAjaxAction()
|
||||||
|
{
|
||||||
|
$entries = array();
|
||||||
|
foreach( AdminLogQuery::getEntries(
|
||||||
|
$this->getRequest()->request->get('admins', array()),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
array_merge($this->getRequest()->request->get('resources', array()), $this->getRequest()->request->get('modules', array()))
|
||||||
|
) as $entry) {
|
||||||
|
|
||||||
|
$entries[] = array(
|
||||||
|
"head" => sprintf(
|
||||||
|
"[%s][%s][%s:%s]",
|
||||||
|
date('Y-m-d H:i:s', $entry->getCreatedAt()->getTimestamp()),
|
||||||
|
$entry->getAdminLogin(),
|
||||||
|
$entry->getResource(),
|
||||||
|
$entry->getAction()
|
||||||
|
),
|
||||||
|
"data" => $entry->getMessage(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render(
|
||||||
|
'ajax/logger',
|
||||||
|
array(
|
||||||
|
'entries' => $entries,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Thelia\Model;
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
use Thelia\Model\Base\AdminLogQuery as BaseAdminLogQuery;
|
use Thelia\Model\Base\AdminLogQuery as BaseAdminLogQuery;
|
||||||
|
|
||||||
|
|
||||||
@@ -15,6 +16,41 @@ use Thelia\Model\Base\AdminLogQuery as BaseAdminLogQuery;
|
|||||||
* long as it does not already exist in the output directory.
|
* long as it does not already exist in the output directory.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class AdminLogQuery extends BaseAdminLogQuery {
|
class AdminLogQuery extends BaseAdminLogQuery
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param null $login
|
||||||
|
* @param \DateTime $maxDateTime
|
||||||
|
* @param \DateTime $minDateTime
|
||||||
|
* @param null $resources
|
||||||
|
* @param null $actions
|
||||||
|
*
|
||||||
|
* @return array|mixed|\Propel\Runtime\Collection\ObjectCollection
|
||||||
|
*/
|
||||||
|
public static function getEntries($login = null, \DateTime $maxDateTime = null, \DateTime $minDateTime = null, $resources = null, $actions = null)
|
||||||
|
{
|
||||||
|
$search = self::create();
|
||||||
|
|
||||||
|
if(null !== $minDateTime) {
|
||||||
|
$search->filterByCreatedAt($minDateTime->getTimestamp(), Criteria::GREATER_EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(null !== $maxDateTime) {
|
||||||
|
$search->filterByCreatedAt($maxDateTime->getTimestamp(), Criteria::LESS_EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(null !== $resources) {
|
||||||
|
$search->filterByResource($resources);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(null !== $actions) {
|
||||||
|
$search->filterByAction($actions);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(null !== $login) {
|
||||||
|
$search->filterByAdminLogin($login);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $search->find();
|
||||||
|
}
|
||||||
} // AdminLogQuery
|
} // AdminLogQuery
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<ul class="breadcrumb">
|
<ul class="breadcrumb">
|
||||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||||
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
|
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
|
||||||
<li><a href="{url path='/admin/configuration/adminLogs'}">{intl l="Admin logs"}</a></li>
|
<li><a href="{url path='/admin/configuration/adminLogs'}">{intl l="Administration logs"}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{module_include location='admin_logs_top'}
|
{module_include location='admin_logs_top'}
|
||||||
@@ -22,99 +22,84 @@
|
|||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="general-block-decorator">
|
<div class="general-block-decorator">
|
||||||
|
|
||||||
<div class="title title-without-tabs">{intl l="Configuration variables"}</div>
|
<div class="title title-without-tabs">{intl l="Administration logs"}</div>
|
||||||
|
|
||||||
{form name="thelia.admin.mailing-system.update"}
|
<div class="col-md-12 clearfix">
|
||||||
|
|
||||||
<form method="POST" action="{url path="/admin/configuration/mailingSystem/save"}" {form_enctype form=$form} >
|
<div class="row inner-toolbar">
|
||||||
|
<div class="col-md-12 inner-actions clearfix">
|
||||||
<div class="row inner-toolbar">
|
<button type="button" class="btn btn-default btn-success pull-right js-show-logs" title="Show logs">Show logs <span class="glyphicon glyphicon-eye-open"></span></button>
|
||||||
<div class="col-md-12 inner-actions clearfix">
|
|
||||||
<button type="submit" name="save_mode" value="stay" class="btn btn-default btn-success pull-right" title="Save">Save <span class="glyphicon glyphicon-ok"></span></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{form_hidden_fields form=$form}
|
<div>
|
||||||
|
<strong>Administrators :</strong>
|
||||||
|
</div>
|
||||||
|
|
||||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
<div class="row">
|
||||||
|
{loop type="admin" name="admin-list" backend_context="1"}
|
||||||
{form_field form=$form field='enabled'}
|
{if ($LOOP_COUNT-1)%4 == 0 AND $LOOP_COUNT != 0 AND $LOOP_COUNT != $LOOP_TOTAL}
|
||||||
<div class="form-group">
|
|
||||||
<label for="{$label_attr.for}" class="label-control">{intl l="Enable remote SMTP use : "}</label>
|
|
||||||
|
|
||||||
<input type="hidden" id="smtp_enabled" name="{$name}" value="{if $form_error}{$value}{else}{if {config key="smtp.enabled"}}1{else}0{/if}{/if}">
|
|
||||||
|
|
||||||
<div class="make-switch switch-small" id="enable-smtp" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
|
||||||
<input type="checkbox" id="{$label_attr.for}" {if $form_error AND $value == 1 OR !$form_error AND {config key="smtp.enabled"} == 1}checked{/if}>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field='host'}
|
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
|
||||||
<label for="{$label_attr.for}" class="label-control">{intl l="Host :"}</label>
|
|
||||||
<input type="text" class="form-control" id="{$label_attr.for}" name="{$name}" placeholder="{intl l="Host"}" value="{if $form_error}{$value}{else}{config key="smtp.host"}{/if}">
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field='port'}
|
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
|
||||||
<label for="{$label_attr.for}" class="label-control">{intl l="Port :"}</label>
|
|
||||||
<input type="text" class="form-control" id="{$label_attr.for}" name="{$name}" placeholder="{intl l="Port"}" value="{if $form_error}{$value}{else}{config key="smtp.port"}{/if}">
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field='encryption'}
|
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
|
||||||
<label for="{$label_attr.for}" class="label-control">{intl l="Encryption :"}</label>
|
|
||||||
<input type="text" class="form-control" id="{$label_attr.for}" name="{$name}" placeholder="{intl l="Encryption"}" value="{if $form_error}{$value}{else}{config key="smtp.encryption"}{/if}">
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field='username'}
|
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
|
||||||
<label for="{$label_attr.for}" class="label-control">{intl l="Username :"}</label>
|
|
||||||
<input type="text" class="form-control" id="{$label_attr.for}" name="{$name}" placeholder="{intl l="Username"}" value="{if $form_error}{$value}{else}{config key="smtp.username"}{/if}">
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field='password'}
|
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
|
||||||
<label for="{$label_attr.for}" class="label-control">{intl l="Password :"}</label>
|
|
||||||
<input type="password" class="form-control" id="{$label_attr.for}" name="{$name}" value="{if $form_error}{$value}{else}{config key="smtp.password"}{/if}">
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field='authmode'}
|
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
|
||||||
<label for="{$label_attr.for}" class="label-control">{intl l="Auth Mode :"}</label>
|
|
||||||
<input type="text" class="form-control" id="{$label_attr.for}" name="{$name}" placeholder="{intl l="Auth Mode"}" value="{if $form_error}{$value}{else}{config key="smtp.authmode"}{/if}">
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field='timeout'}
|
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
|
||||||
<label for="{$label_attr.for}" class="label-control">{intl l="Timeout :"}</label>
|
|
||||||
<input type="text" class="form-control" id="{$label_attr.for}" name="{$name}" placeholder="{intl l="Timeout"}" value="{if $form_error}{$value}{else}{config key="smtp.timeout"}{/if}">
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field='sourceip'}
|
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
|
||||||
<label for="{$label_attr.for}" class="label-control">{intl l="Source IP :"}</label>
|
|
||||||
<input type="text" class="form-control" id="{$label_attr.for}" name="{$name}" placeholder="{intl l="Source IP"}" value="{if $form_error}{$value}{else}{config key="smtp.sourceip"}{/if}">
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
<div class="row inner-toolbar">
|
|
||||||
<div class="col-md-12 inner-actions clearfix">
|
|
||||||
<button type="submit" name="save_mode" value="stay" class="btn btn-default btn-success pull-right" title="Save">Save <span class="glyphicon glyphicon-ok"></span></button>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
{/if}
|
||||||
|
<div class="col-md-3">
|
||||||
|
<input id="admin_{$ID}" data-id="{$LOGIN}" class="js-admin" type="checkbox" checked>
|
||||||
|
<label for="admin_{$ID}" style="font-weight: normal;">{$LOGIN} ({$FIRSTNAME|upper} {$LASTNAME|ucwords})</label>
|
||||||
</div>
|
</div>
|
||||||
|
{/loop}
|
||||||
|
</div>
|
||||||
|
|
||||||
</form>
|
</div>
|
||||||
|
|
||||||
{/form}
|
<div class="col-md-12 clearfix">
|
||||||
|
<div>
|
||||||
|
<strong>Resources :</strong>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
{loop type="resource" name="resources-list" backend_context="1"}
|
||||||
|
{if ($LOOP_COUNT-1)%4 == 0 AND $LOOP_COUNT != 0 AND $LOOP_COUNT != $LOOP_TOTAL}
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
{/if}
|
||||||
|
<div class="col-md-3">
|
||||||
|
<input id="resource_{$ID}" data-id="{$CODE}" class="js-resource" type="checkbox" checked>
|
||||||
|
<label for="resource_{$ID}" style="font-weight: normal;">{$TITLE}</label>
|
||||||
|
</div>
|
||||||
|
{/loop}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-12 clearfix">
|
||||||
|
<div>
|
||||||
|
<strong>Modules :</strong>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
{loop type="module" name="modules-list" backend_context="1"}
|
||||||
|
{if ($LOOP_COUNT-1)%4 == 0 AND $LOOP_COUNT != 0 AND $LOOP_COUNT != $LOOP_TOTAL}
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
{/if}
|
||||||
|
<div class="col-md-3">
|
||||||
|
<input id="module_{$ID}" data-id="{$CODE}" class="js-module" type="checkbox" checked>
|
||||||
|
<label for="module_{$ID}" style="font-weight: normal;">{$TITLE}</label>
|
||||||
|
</div>
|
||||||
|
{/loop}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row inner-toolbar">
|
||||||
|
<div class="col-md-12 inner-actions clearfix">
|
||||||
|
<button type="button" class="btn btn-default btn-success pull-right js-show-logs" title="Show logs">Show logs <span class="glyphicon glyphicon-eye-open"></span></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="loading-block" class="col-md-12 loading-block"></div>
|
||||||
|
|
||||||
|
<div class="col-md-12 clearfix" id="logger-display"></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -134,8 +119,39 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
jQuery(function($) {
|
jQuery(function($) {
|
||||||
$('#enable-smtp').on('switch-change', function (e, data) {
|
$('.js-show-logs').click(function(e) {
|
||||||
$('#smtp_enabled').val(data.value ? 1 : 0);
|
|
||||||
|
$('.js-show-logs').attr('disabled', true);
|
||||||
|
$('#logger-display').html('');
|
||||||
|
$('#loading-block').show();
|
||||||
|
|
||||||
|
var admins = new Array();
|
||||||
|
var resources = new Array();
|
||||||
|
var modules = new Array();
|
||||||
|
|
||||||
|
$('.js-admin:checked').each(function(k, v) {
|
||||||
|
admins.push($(v).data('id'));
|
||||||
|
})
|
||||||
|
$('.js-resource:checked').each(function(k, v) {
|
||||||
|
resources.push($(v).data('id'));
|
||||||
|
})
|
||||||
|
$('.js-module:checked').each(function(k, v) {
|
||||||
|
modules.push($(v).data('id'));
|
||||||
|
})
|
||||||
|
|
||||||
|
$.post(
|
||||||
|
"{url path='/admin/configuration/adminLogs/logger'}",
|
||||||
|
{
|
||||||
|
admins: admins,
|
||||||
|
resources: resources,
|
||||||
|
modules: modules
|
||||||
|
},
|
||||||
|
function(html) {
|
||||||
|
$('#loading-block').hide();
|
||||||
|
$('#logger-display').html(html);
|
||||||
|
$('.js-show-logs').attr('disabled', false);
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
13
templates/admin/default/ajax/logger.html
Normal file
13
templates/admin/default/ajax/logger.html
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<div class="logger">
|
||||||
|
<ul id="logger-content">
|
||||||
|
{foreach $entries as $entry}
|
||||||
|
<li class="entry">
|
||||||
|
<span class="head">{$entry.head}</span>
|
||||||
|
:
|
||||||
|
<span class="data">{$entry.data}</span>
|
||||||
|
</li>
|
||||||
|
{foreachelse}
|
||||||
|
<li class="no-entry">NO ENTRIES FOUND</li>
|
||||||
|
{/foreach}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
25
templates/admin/default/assets/less/thelia/logger.less
Normal file
25
templates/admin/default/assets/less/thelia/logger.less
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
.logger{
|
||||||
|
margin: 20px 0px 20px 0px;
|
||||||
|
padding: 15px;
|
||||||
|
height: 400px;
|
||||||
|
overflow: scroll;
|
||||||
|
background-color: #000000;
|
||||||
|
color: #ffffff;
|
||||||
|
ul#logger-content{
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
li.entry{
|
||||||
|
list-style-type: none;
|
||||||
|
span.head {
|
||||||
|
color: #9acd32;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
span.data {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
li.no-entry{
|
||||||
|
list-style-type: none;
|
||||||
|
color: #ff0000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
@import "bootstrap-select.less";
|
@import "bootstrap-select.less";
|
||||||
@import "jqplot.less";
|
@import "jqplot.less";
|
||||||
@import "dropzone.less";
|
@import "dropzone.less";
|
||||||
|
@import "logger.less";
|
||||||
|
|
||||||
// -- Base styling ------------------------------------------------------------
|
// -- Base styling ------------------------------------------------------------
|
||||||
|
|
||||||
@@ -295,6 +296,14 @@
|
|||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.loading-block{
|
||||||
|
background: url("@{imgDir}/ajax-loader.gif") no-repeat;
|
||||||
|
margin: auto;
|
||||||
|
height: 30px;
|
||||||
|
width: 30px;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.modal-backdrop .loading {
|
.modal-backdrop .loading {
|
||||||
left: 50%;
|
left: 50%;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
|
|||||||
Reference in New Issue
Block a user