mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Fix #142 : add ability to apply template from user rights view
This commit is contained in:
@@ -88,6 +88,12 @@ class Controller_Admin_Users implements ControllerProviderInterface
|
|||||||
$request = $app['request'];
|
$request = $app['request'];
|
||||||
$rights = new module_admin_route_users_edit($request);
|
$rights = new module_admin_route_users_edit($request);
|
||||||
$rights->apply_rights();
|
$rights->apply_rights();
|
||||||
|
|
||||||
|
if ($app['request']->get('template'))
|
||||||
|
{
|
||||||
|
$rights->apply_template();
|
||||||
|
}
|
||||||
|
|
||||||
$rights->apply_infos();
|
$rights->apply_infos();
|
||||||
|
|
||||||
$datas = array('error' => false);
|
$datas = array('error' => false);
|
||||||
@@ -198,7 +204,7 @@ class Controller_Admin_Users implements ControllerProviderInterface
|
|||||||
{
|
{
|
||||||
$request = $app['request'];
|
$request = $app['request'];
|
||||||
$users = new module_admin_route_users_edit($request);
|
$users = new module_admin_route_users_edit($request);
|
||||||
|
|
||||||
$users->apply_template();
|
$users->apply_template();
|
||||||
|
|
||||||
return new Symfony\Component\HttpFoundation\RedirectResponse('/admin/users/search/');
|
return new Symfony\Component\HttpFoundation\RedirectResponse('/admin/users/search/');
|
||||||
|
@@ -179,13 +179,19 @@ class module_admin_route_users_edit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$query = new User_Query($appbox);
|
||||||
|
$templates = $query
|
||||||
|
->only_templates(true)
|
||||||
|
->execute()->get_results();
|
||||||
|
|
||||||
$this->users_datas = $rs;
|
$this->users_datas = $rs;
|
||||||
$out = array(
|
$out = array(
|
||||||
'datas' => $this->users_datas,
|
'datas' => $this->users_datas,
|
||||||
'users' => $this->users,
|
'users' => $this->users,
|
||||||
'users_serial' => implode(';', $this->users),
|
'users_serial' => implode(';', $this->users),
|
||||||
'base_id' => $this->base_id,
|
'base_id' => $this->base_id,
|
||||||
'main_user' => null
|
'main_user' => null,
|
||||||
|
'templates'=>$templates
|
||||||
);
|
);
|
||||||
|
|
||||||
if (count($this->users) == 1)
|
if (count($this->users) == 1)
|
||||||
|
@@ -106,35 +106,46 @@
|
|||||||
</script>
|
</script>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<div class="tabs PNB10" style="bottom:40px;">
|
<div class="tabs PNB" style="bottom:40px;">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href="#rights_tab">Droits</a>
|
<a href="#rights_tab">{% trans 'Rights' %}</a>
|
||||||
</li>
|
</li>
|
||||||
{% if main_user is not empty and main_user.is_template is empty %}
|
{% if main_user is not empty and main_user.is_template is empty %}
|
||||||
<li>
|
<li>
|
||||||
<a href="#user_infos_tab">Fiche</a>
|
<a href="#user_infos_tab">{% trans 'Infos' %}</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
<div id="rights_tab" class="PNB" style="top:40px;">
|
<div id="rights_tab" class="PNB" style="top:40px;">
|
||||||
<div class="PNB10" style="height:30px;bottom:auto;">
|
|
||||||
<h1>
|
|
||||||
{% if main_user is not empty %}
|
|
||||||
{% set display_name = main_user.get_display_name() %}
|
|
||||||
{% trans %}
|
|
||||||
Edition des droits de {{ display_name }}
|
|
||||||
{% endtrans %}
|
|
||||||
{% else %}
|
|
||||||
{% set number = users|length %}
|
|
||||||
{% trans %}
|
|
||||||
Edition des droits de {{ number }} utilisateurs
|
|
||||||
{% endtrans %}
|
|
||||||
{% endif %}
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
<form id="users_rights_form" method="post" action="/admin/users/rights/apply/">
|
<form id="users_rights_form" method="post" action="/admin/users/rights/apply/">
|
||||||
<input type="hidden" name="users" value="{{users_serial}}"/>
|
<input type="hidden" name="users" value="{{users_serial}}"/>
|
||||||
|
<table style="width:100%;" cellspacing="0" cellpadding="0" border="0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{% if main_user is not empty %}
|
||||||
|
{% set display_name = main_user.get_display_name() %}
|
||||||
|
{% trans %}
|
||||||
|
Edition des droits de {{ display_name }}
|
||||||
|
{% endtrans %}
|
||||||
|
{% else %}
|
||||||
|
{% set number = users|length %}
|
||||||
|
{% trans %}
|
||||||
|
Edition des droits de {{ number }} utilisateurs
|
||||||
|
{% endtrans %}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td style="text-align:right;">
|
||||||
|
{% trans 'Apply a template' %}
|
||||||
|
<select name="template">
|
||||||
|
<option value="">{% trans 'boutton::choisir' %}</option>
|
||||||
|
{% for template in templates %}
|
||||||
|
<option value="{{ template.get_id() }}">{{ template.get_display_name() }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
<table cellspacing="0" cellpadding="0" border="0" style="table-layout: auto;width:820px;height:67px;bottom:auto;top:50px;" class="PNB10">
|
<table cellspacing="0" cellpadding="0" border="0" style="table-layout: auto;width:820px;height:67px;bottom:auto;top:50px;" class="PNB10">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -521,6 +532,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="PNB10" style="top:auto;height:20px;">
|
<div class="PNB10" style="top:auto;height:20px;">
|
||||||
<button class="users_rights_valid">{% trans 'boutton::valider' %}</button>
|
<button class="users_rights_valid">{% trans 'boutton::valider' %}</button>
|
||||||
|
<a href="/admin/users/search/" class="users_rights_cancel">{% trans 'boutton::retour' %}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -78,6 +78,7 @@ function ini_edit_usrs(){
|
|||||||
var datas = {
|
var datas = {
|
||||||
users:$('#users_rights_form input[name="users"]').val(),
|
users:$('#users_rights_form input[name="users"]').val(),
|
||||||
values:$('#users_rights_form').serialize(),
|
values:$('#users_rights_form').serialize(),
|
||||||
|
template:$('#users_rights_form select[name="template"]').val(),
|
||||||
user_infos:$('#user_infos_form').serialize()
|
user_infos:$('#user_infos_form').serialize()
|
||||||
};
|
};
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -94,6 +95,17 @@ function ini_edit_usrs(){
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#right-ajax .users_rights_cancel').bind('click', function(){
|
||||||
|
var $this = $(this);
|
||||||
|
$('#right-ajax').empty().addClass('loading').parent().show();
|
||||||
|
$('#right').hide();
|
||||||
|
$.get($this.attr('href'), function(data) {
|
||||||
|
$('#right-ajax').removeClass('loading').html(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
var time_buttons = {
|
var time_buttons = {
|
||||||
'Ok':function(){
|
'Ok':function(){
|
||||||
|
Reference in New Issue
Block a user