mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
Add User lists share
This commit is contained in:
145
templates/web/prod/actions/Feedback/List-Share.html.twig
Normal file
145
templates/web/prod/actions/Feedback/List-Share.html.twig
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
{% if list is empty %}
|
||||||
|
{% trans 'You are not authorized to do this' %}
|
||||||
|
{% else %}
|
||||||
|
<div id="ListShare">
|
||||||
|
<div>
|
||||||
|
<form name="list_share_user">
|
||||||
|
<input type="text" class="search" name="user" value="" style="width:120px" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<form name="owners">
|
||||||
|
{% for owner in list.getOwners() %}
|
||||||
|
<table class="owner">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<img src="/skins/icons/user.png"/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ owner.getUser().get_display_name() }}
|
||||||
|
<input type="hidden" name="usr_id" value="{{ owner.getUser().get_id() }}" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<label>{% trans 'Role' %}</label>
|
||||||
|
<select name="role">
|
||||||
|
<option {% if owner.getRole() == constant('\\Entities\\UsrListOwner::ROLE_USER') %}selected {% endif %} value="{{ constant('\\Entities\\UsrListOwner::ROLE_USER') }}">
|
||||||
|
{% trans 'Access' %}
|
||||||
|
</option>
|
||||||
|
<option {% if owner.getRole() == constant('\\Entities\\UsrListOwner::ROLE_EDITOR') %}selected {% endif %} value="{{ constant('\\Entities\\UsrListOwner::ROLE_EDITOR') }}">
|
||||||
|
{% trans 'Editor' %}
|
||||||
|
</option>
|
||||||
|
<option {% if owner.getRole() == constant('\\Entities\\UsrListOwner::ROLE_ADMIN') %}selected {% endif %} value="{{ constant('\\Entities\\UsrListOwner::ROLE_ADMIN') }}">
|
||||||
|
{% trans 'Admin' %}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="#" class="deleter">
|
||||||
|
<img src="/skins/prod/Push/close_badge.png" title="{% trans 'Remove' %}"/>
|
||||||
|
</a>
|
||||||
|
<a href="#" class="notifier">
|
||||||
|
<img src="/skins/prod/Push/Notify.png" title="{% trans 'Notify' %}"/>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
{% endfor %}
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function(){
|
||||||
|
var $container = $('#ListShare'),
|
||||||
|
$completer_form = $('form[name="list_share_user"]', $container),
|
||||||
|
$owners_form = $('form[name="owners"]', $container),
|
||||||
|
$autocompleter = $('input[name="user"]', $completer_form),
|
||||||
|
$dialog = p4.Dialog.get(2);
|
||||||
|
|
||||||
|
$completer_form.bind('submit', function(){
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
$('select[name="role"]', $owners_form).bind('change', function(){
|
||||||
|
var usr_id = $(this).closest('.owner').find('input[name="usr_id"]').val(),
|
||||||
|
role = $(this).val();
|
||||||
|
|
||||||
|
shareWith(usr_id, role);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function shareWith(usr_id, role)
|
||||||
|
{
|
||||||
|
var role = typeof role === 'undefined' ? 1 : role;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: '/prod/lists/list/{{ list.getId() }}/share/' + usr_id + '/',
|
||||||
|
dataType: 'json',
|
||||||
|
data : {role : role},
|
||||||
|
beforeSend:function(){
|
||||||
|
},
|
||||||
|
success: function(data){
|
||||||
|
if(data.success)
|
||||||
|
{
|
||||||
|
humane.info(data.message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
humane.error(data.message);
|
||||||
|
}
|
||||||
|
$dialog.refresh();
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
error: function(){
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
timeout: function(){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$autocompleter.autocomplete({
|
||||||
|
minLength: 2,
|
||||||
|
source: function( request, response ) {
|
||||||
|
$.ajax({
|
||||||
|
url: '/prod/push/search-user/',
|
||||||
|
dataType: "json",
|
||||||
|
data: {
|
||||||
|
query: request.term
|
||||||
|
},
|
||||||
|
success: function( data ) {
|
||||||
|
response( data );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
select: function( event, ui ) {
|
||||||
|
if(ui.item.type == 'USER')
|
||||||
|
{
|
||||||
|
shareWith(ui.item.usr_id);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.data( "autocomplete" )._renderItem = function( ul, item ) {
|
||||||
|
|
||||||
|
$autocompleter.addClass('loading');
|
||||||
|
|
||||||
|
var callback = function(datas){
|
||||||
|
$(datas).data( "item.autocomplete", item ).appendTo( ul );
|
||||||
|
$autocompleter.data( "autocomplete" ).menu.refresh();
|
||||||
|
$autocompleter.data('autocomplete')._resizeMenu();
|
||||||
|
$autocompleter.removeClass('loading');
|
||||||
|
};
|
||||||
|
|
||||||
|
if(item.type == 'USER')
|
||||||
|
{
|
||||||
|
var datas = p4.Mustache.Render('List-User-Item', item, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endif %}
|
@@ -170,3 +170,20 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|
||||||
|
{% macro badgeReadonly(entry) %}
|
||||||
|
<div class="badge">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td class="icon">
|
||||||
|
<img src="/skins/icons/user.png"/>
|
||||||
|
</td>
|
||||||
|
<td class="infos">
|
||||||
|
<span class="name">{{ entry.getUser().get_display_name() }}</span>
|
||||||
|
<span class="subtite"></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{% endmacro %}
|
@@ -5,133 +5,159 @@
|
|||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
{% if list.getOwner(user).getRole() >= constant('\\Entities\\UsrListOwner::ROLE_EDITOR') %}
|
||||||
<form method="POST" action="/prod/lists/list/{{ list.getId() }}/update/">
|
<form method="POST" action="/prod/lists/list/{{ list.getId() }}/update/">
|
||||||
<label>{% trans 'List Name' %}</label>
|
<label>{% trans 'List Name' %}</label>
|
||||||
<input name="name" value="{{ list.getName() }}"/>
|
<input name="name" value="{{ list.getName() }}"/>
|
||||||
</form>
|
</form>
|
||||||
|
{% else %}
|
||||||
|
<h1>{{ list.getName() }}</h1>
|
||||||
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="/prod/lists/list/share" class="list_sharer">
|
{% if list.getOwner(user).getRole() == constant('\\Entities\\UsrListOwner::ROLE_ADMIN') %}
|
||||||
|
<a href="/prod/lists/list/{{ list.getId() }}/share/" title="{% trans 'Share the list' %}" class="list_sharer">
|
||||||
<img src="/skins/prod/Push/list-icon.png" />
|
<img src="/skins/prod/Push/list-icon.png" />
|
||||||
{% trans "Set sharing permission" %}
|
{% trans "Set sharing permission" %}
|
||||||
</a>
|
</a>
|
||||||
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<form name="list-editor-search" method="POST" action="/prod/push/edit-list/{{ list.getId() }}/">
|
{% if list.getOwner(user).getRole() >= constant('\\Entities\\UsrListOwner::ROLE_EDITOR') %}
|
||||||
<div class="PNB" style="top:40px;height:40px;bottom:auto;">
|
<form name="list-editor-search" method="POST" action="/prod/push/edit-list/{{ list.getId() }}/">
|
||||||
|
<div class="PNB" style="top:40px;height:40px;bottom:auto;">
|
||||||
|
|
||||||
<select name="like_field">
|
<select name="like_field">
|
||||||
<option value="usr_login">
|
<option value="usr_login">
|
||||||
{% trans 'Push::filter on login' %}
|
{% trans 'Push::filter on login' %}
|
||||||
</option>
|
</option>
|
||||||
<option value="name">
|
<option value="name">
|
||||||
{% trans 'Push::filter on name' %}
|
{% trans 'Push::filter on name' %}
|
||||||
</option>
|
</option>
|
||||||
<option value="pays">
|
<option value="pays">
|
||||||
{% trans 'Push::filter on countries' %}
|
{% trans 'Push::filter on countries' %}
|
||||||
</option>
|
</option>
|
||||||
<option value="societe">
|
<option value="societe">
|
||||||
{% trans 'Push::filter on companies' %}
|
{% trans 'Push::filter on companies' %}
|
||||||
</option>
|
</option>
|
||||||
<option value="usr_mail">
|
<option value="usr_mail">
|
||||||
{% trans 'Push::filter on emails' %}
|
{% trans 'Push::filter on emails' %}
|
||||||
</option>
|
</option>
|
||||||
<option value="lastModel">
|
<option value="lastModel">
|
||||||
{% trans 'Push::filter on templates' %}
|
{% trans 'Push::filter on templates' %}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
{% trans 'Push::filter starts' %}
|
{% trans 'Push::filter starts' %}
|
||||||
<input type="text" value="" class="search" name="query">
|
<input type="text" value="" class="search" name="query">
|
||||||
<button type="submit">
|
<button type="submit">
|
||||||
{% trans 'boutton::chercher' %}
|
{% trans 'boutton::chercher' %}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="PNB" style="top:80px;height:120px;bottom:auto;">
|
|
||||||
<table style="table-layout:fixed;">
|
|
||||||
<tr>
|
|
||||||
<td style="width:20%;">
|
|
||||||
<label>
|
|
||||||
{% trans 'Activite' %}
|
|
||||||
</label>
|
|
||||||
<select size="5" multiple="multiple" name="Activity[]" style="width:80%;">
|
|
||||||
<option value="">{% trans 'All' %}</option>
|
|
||||||
{% for Activity in query.getRelatedActivities() %}
|
|
||||||
<option value="{{ Activity }}">{{ Activity }}</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</td>
|
|
||||||
<td style="width:20%;">
|
|
||||||
<label>
|
|
||||||
{% trans 'Template' %}
|
|
||||||
</label>
|
|
||||||
<select size="5" multiple="multiple" name="Template[]" style="width:80%;">
|
|
||||||
<option value="">{% trans 'All' %}</option>
|
|
||||||
{% for Template in query.getRelatedTemplates() %}
|
|
||||||
<option value="{{ Template }}">{{ Template }}</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</td>
|
|
||||||
<td style="width:20%;">
|
|
||||||
<label>
|
|
||||||
{% trans 'Company' %}
|
|
||||||
</label>
|
|
||||||
<select size="5" multiple="multiple" name="Company[]" style="width:80%;">
|
|
||||||
<option value="">{% trans 'All' %}</option>
|
|
||||||
{% for Company in query.getRelatedCompanies() %}
|
|
||||||
<option value="{{ Company }}">{{ Company }}</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</td>
|
|
||||||
<td style="width:20%;">
|
|
||||||
<label>
|
|
||||||
{% trans 'Country' %}
|
|
||||||
</label>
|
|
||||||
<select size="5" multiple="multiple" name="Country[]" style="width:80%;">
|
|
||||||
<option value="">{% trans 'All' %}</option>
|
|
||||||
{% for Code, Country in query.getRelatedCountries() %}
|
|
||||||
<option value="{{ Code }}">{{ Country }}</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</td>
|
|
||||||
<td style="width:20%;">
|
|
||||||
<label>
|
|
||||||
{% trans 'Position' %}
|
|
||||||
</label>
|
|
||||||
<select size="5" multiple="multiple" name="Position[]" style="width:80%;">
|
|
||||||
<option value="">{% trans 'All' %}</option>
|
|
||||||
{% for Position in query.getRelatedPositions() %}
|
|
||||||
<option value="{{ Position }}">{{ Position }}</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<input type="hidden" name="page" value="" />
|
|
||||||
<input type="hidden" name="srt" value="{{ sort }}" />
|
|
||||||
<input type="hidden" name="ord" value="{{ ord }}" />
|
|
||||||
<input type="hidden" name="type" value="fragment" />
|
|
||||||
</form>
|
|
||||||
<div class="PNB content" style="top:200px;">
|
|
||||||
<div class="PNB10">
|
|
||||||
<div class="PNB" style="height:25px;bottom:auto;">
|
|
||||||
<p>
|
|
||||||
{% set length = '<span class="counter current">' ~ list.getEntries().count() ~ '</span>' %}
|
|
||||||
{% trans %}
|
|
||||||
{{ length }} peoples
|
|
||||||
{% endtrans %}
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
{{ ListsMacros.ResultTable(query, results, list, sort, ord) }}
|
<div class="PNB" style="top:80px;height:120px;bottom:auto;">
|
||||||
|
<table style="table-layout:fixed;">
|
||||||
|
<tr>
|
||||||
|
<td style="width:20%;">
|
||||||
|
<label>
|
||||||
|
{% trans 'Activite' %}
|
||||||
|
</label>
|
||||||
|
<select size="5" multiple="multiple" name="Activity[]" style="width:80%;">
|
||||||
|
<option value="">{% trans 'All' %}</option>
|
||||||
|
{% for Activity in query.getRelatedActivities() %}
|
||||||
|
<option value="{{ Activity }}">{{ Activity }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
<td style="width:20%;">
|
||||||
|
<label>
|
||||||
|
{% trans 'Template' %}
|
||||||
|
</label>
|
||||||
|
<select size="5" multiple="multiple" name="Template[]" style="width:80%;">
|
||||||
|
<option value="">{% trans 'All' %}</option>
|
||||||
|
{% for Template in query.getRelatedTemplates() %}
|
||||||
|
<option value="{{ Template }}">{{ Template }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
<td style="width:20%;">
|
||||||
|
<label>
|
||||||
|
{% trans 'Company' %}
|
||||||
|
</label>
|
||||||
|
<select size="5" multiple="multiple" name="Company[]" style="width:80%;">
|
||||||
|
<option value="">{% trans 'All' %}</option>
|
||||||
|
{% for Company in query.getRelatedCompanies() %}
|
||||||
|
<option value="{{ Company }}">{{ Company }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
<td style="width:20%;">
|
||||||
|
<label>
|
||||||
|
{% trans 'Country' %}
|
||||||
|
</label>
|
||||||
|
<select size="5" multiple="multiple" name="Country[]" style="width:80%;">
|
||||||
|
<option value="">{% trans 'All' %}</option>
|
||||||
|
{% for Code, Country in query.getRelatedCountries() %}
|
||||||
|
<option value="{{ Code }}">{{ Country }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
<td style="width:20%;">
|
||||||
|
<label>
|
||||||
|
{% trans 'Position' %}
|
||||||
|
</label>
|
||||||
|
<select size="5" multiple="multiple" name="Position[]" style="width:80%;">
|
||||||
|
<option value="">{% trans 'All' %}</option>
|
||||||
|
{% for Position in query.getRelatedPositions() %}
|
||||||
|
<option value="{{ Position }}">{{ Position }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" name="page" value="" />
|
||||||
|
<input type="hidden" name="srt" value="{{ sort }}" />
|
||||||
|
<input type="hidden" name="ord" value="{{ ord }}" />
|
||||||
|
<input type="hidden" name="type" value="fragment" />
|
||||||
|
</form>
|
||||||
|
<div class="PNB content" style="top:200px;">
|
||||||
|
<div class="PNB10">
|
||||||
|
<div class="PNB" style="height:25px;bottom:auto;">
|
||||||
|
<p>
|
||||||
|
{% set length = '<span class="counter current">' ~ list.getEntries().count() ~ '</span>' %}
|
||||||
|
{% trans %}
|
||||||
|
{{ length }} peoples
|
||||||
|
{% endtrans %}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{{ ListsMacros.ResultTable(query, results, list, sort, ord) }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% else %}
|
||||||
|
<div class="PNB content readonly" style="top:40px;">
|
||||||
|
<div class="PNB10">
|
||||||
|
<div class="PNB" style="height:25px;bottom:auto;">
|
||||||
|
<p>
|
||||||
|
{% set length = '<span class="counter current">' ~ list.getEntries().count() ~ '</span>' %}
|
||||||
|
{% trans %}
|
||||||
|
{{ length }} peoples
|
||||||
|
{% endtrans %}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="PNB" style="top:35px;overflow:auto;">
|
||||||
|
{% for entry in list.getEntries() %}
|
||||||
|
{{ ListsMacros.badgeReadonly(entry) }}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
@@ -12,17 +12,23 @@
|
|||||||
{% set length = '<span class="counter">' ~ list.getEntries().count() ~ '</span>' %}
|
{% set length = '<span class="counter">' ~ list.getEntries().count() ~ '</span>' %}
|
||||||
<li class="list">
|
<li class="list">
|
||||||
<a href="/prod/push/edit-list/{{ list.getId() }}/" class="link">
|
<a href="/prod/push/edit-list/{{ list.getId() }}/" class="link">
|
||||||
<img src="/skins/prod/Push/list-icon.png" />
|
{% if list.getOwner(user).getRole() >= constant('\\Entities\\UsrListOwner::ROLE_EDITOR') %}
|
||||||
|
<img src="/skins/prod/Push/list-icon.png" />
|
||||||
|
{% else %}
|
||||||
|
<img src="/skins/icons/SHARE16.png" />
|
||||||
|
{% endif %}
|
||||||
"{{ list.getName() }}"
|
"{{ list.getName() }}"
|
||||||
{% trans %}
|
{% trans %}
|
||||||
{{ length }} peoples
|
{{ length }} peoples
|
||||||
{% endtrans %}
|
{% endtrans %}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
{% if list.getOwner(user).getRole() >= constant('\\Entities\\UsrListOwner::ROLE_ADMIN') %}
|
||||||
<a href="/prod/lists/list/{{ list.getId() }}/delete/" class="deleter">
|
<a href="/prod/lists/list/{{ list.getId() }}/delete/" class="deleter">
|
||||||
{% trans 'Delete' %}
|
{% trans 'Delete' %}
|
||||||
<input type="hidden" name="list_id" value="{{ list.getId() }}"/>
|
<input type="hidden" name="list_id" value="{{ list.getId() }}"/>
|
||||||
</a>
|
</a>
|
||||||
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
Reference in New Issue
Block a user