mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Workzone stories attach/detach
This commit is contained in:
@@ -219,91 +219,6 @@ class Story implements ControllerProviderInterface
|
|||||||
return new RedirectResponse('/');
|
return new RedirectResponse('/');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$controllers->post(
|
|
||||||
'/{sbas_id}/{record_id}/attach/'
|
|
||||||
, function(Application $app, Request $request, $sbas_id, $record_id)
|
|
||||||
{
|
|
||||||
$Story = new \record_adapter($sbas_id, $record_id);
|
|
||||||
|
|
||||||
if (!$Story->is_grouping())
|
|
||||||
throw new \Exception('You can only attach stories');
|
|
||||||
|
|
||||||
$user = $app['Core']->getAuthenticatedUser();
|
|
||||||
|
|
||||||
if (!$user->ACL()->has_access_to_base($Story->get_base_id()))
|
|
||||||
throw new \Exception_Forbidden('You do not have access to this Story');
|
|
||||||
|
|
||||||
$em = $app['Core']->getEntityManager();
|
|
||||||
/* @var $em \Doctrine\ORM\EntityManager */
|
|
||||||
$StoryWZ = new \Entities\StoryWZ();
|
|
||||||
$StoryWZ->setUser($user);
|
|
||||||
$StoryWZ->setRecord($Story);
|
|
||||||
|
|
||||||
$em->persist($StoryWZ);
|
|
||||||
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
$data = array(
|
|
||||||
'success' => true
|
|
||||||
, 'message' => _('Story attached to the WorkZone')
|
|
||||||
, 'StoryWZ' => array(
|
|
||||||
'id' => $StoryWZ->getId()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($request->getRequestFormat() == 'json')
|
|
||||||
{
|
|
||||||
|
|
||||||
$datas = $app['Core']['Serializer']->serialize($data, 'json');
|
|
||||||
|
|
||||||
return new Response($datas, 200, array('Content-type' => 'application/json'));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new RedirectResponse('/{sbas_id}/{record_id}/');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$controllers->post(
|
|
||||||
'/{sbas_id}/{record_id}/detach/'
|
|
||||||
, function(Application $app, Request $request, $sbas_id, $record_id)
|
|
||||||
{
|
|
||||||
$Story = new \record_adapter($sbas_id, $record_id);
|
|
||||||
|
|
||||||
$user = $app['Core']->getAuthenticatedUser();
|
|
||||||
|
|
||||||
$em = $app['Core']->getEntityManager();
|
|
||||||
|
|
||||||
$repository = $em->getRepository('\Entities\StoryWZ');
|
|
||||||
|
|
||||||
/* @var $repository \Repositories\StoryWZRepository */
|
|
||||||
$StoryWZ = $repository->findUserStory($user, $Story);
|
|
||||||
|
|
||||||
if (!$StoryWZ)
|
|
||||||
{
|
|
||||||
throw new \Exception_NotFound('Story not found');
|
|
||||||
}
|
|
||||||
$em->remove($StoryWZ);
|
|
||||||
|
|
||||||
$em->flush();
|
|
||||||
|
|
||||||
$data = array(
|
|
||||||
'success' => true
|
|
||||||
, 'message' => _('Story detached from the WorkZone')
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($request->getRequestFormat() == 'json')
|
|
||||||
{
|
|
||||||
$datas = $app['Core']['Serializer']->serialize($data, 'json');
|
|
||||||
|
|
||||||
return new Response($datas, 200, array('Content-type' => 'application/json'));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new RedirectResponse('/');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// $controllers->post('/{basket_id}/delete/', function(Application $app, Request $request, $basket_id)
|
// $controllers->post('/{basket_id}/delete/', function(Application $app, Request $request, $basket_id)
|
||||||
// {
|
// {
|
||||||
// $em = $app['Core']->getEntityManager();
|
// $em = $app['Core']->getEntityManager();
|
||||||
|
@@ -50,6 +50,147 @@ class WorkZone implements ControllerProviderInterface
|
|||||||
return new Response($twig->render('prod/WorkZone/WorkZone.html.twig', $params));
|
return new Response($twig->render('prod/WorkZone/WorkZone.html.twig', $params));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$controllers->post(
|
||||||
|
'/attachStories/'
|
||||||
|
, function(Application $app, Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$user = $app['Core']->getAuthenticatedUser();
|
||||||
|
|
||||||
|
$em = $app['Core']->getEntityManager();
|
||||||
|
/* @var $em \Doctrine\ORM\EntityManager */
|
||||||
|
|
||||||
|
$StoryWZRepo = $em->getRepository('\Entities\StoryWZ');
|
||||||
|
|
||||||
|
$alreadyFixed = $done = 0;
|
||||||
|
|
||||||
|
foreach ($request->get('stories') as $element)
|
||||||
|
{
|
||||||
|
$element = explode('_', $element);
|
||||||
|
$Story = new \record_adapter($element[0], $element[1]);
|
||||||
|
|
||||||
|
if (!$Story->is_grouping())
|
||||||
|
throw new \Exception('You can only attach stories');
|
||||||
|
|
||||||
|
if (!$user->ACL()->has_access_to_base($Story->get_base_id()))
|
||||||
|
throw new \Exception_Forbidden('You do not have access to this Story');
|
||||||
|
|
||||||
|
|
||||||
|
if ($StoryWZRepo->findUserStory($user, $Story))
|
||||||
|
{
|
||||||
|
$alreadyFixed++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$StoryWZ = new \Entities\StoryWZ();
|
||||||
|
$StoryWZ->setUser($user);
|
||||||
|
$StoryWZ->setRecord($Story);
|
||||||
|
|
||||||
|
$em->persist($StoryWZ);
|
||||||
|
$done++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$em->flush();
|
||||||
|
|
||||||
|
if ($alreadyFixed === 0)
|
||||||
|
{
|
||||||
|
if ($done <= 1)
|
||||||
|
{
|
||||||
|
$message = sprintf(
|
||||||
|
_('%d Story attached to the WorkZone')
|
||||||
|
, $done
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$message = sprintf(
|
||||||
|
_('%d Stories attached to the WorkZone')
|
||||||
|
, $done
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($done <= 1)
|
||||||
|
{
|
||||||
|
$message = sprintf(
|
||||||
|
_('%1$d Story attached to the WorkZone, %2$d already attached')
|
||||||
|
, $done
|
||||||
|
, $alreadyFixed
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$message = sprintf(
|
||||||
|
_('%1$d Story attached to the WorkZone, %2$d already attached')
|
||||||
|
, $done
|
||||||
|
, $alreadyFixed
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'success' => true
|
||||||
|
, 'message' => $message
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($request->getRequestFormat() == 'json')
|
||||||
|
{
|
||||||
|
|
||||||
|
$datas = $app['Core']['Serializer']->serialize($data, 'json');
|
||||||
|
|
||||||
|
return new Response($datas, 200, array('Content-type' => 'application/json'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new RedirectResponse('/{sbas_id}/{record_id}/');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$controllers->post(
|
||||||
|
'/detachStory/{sbas_id}/{record_id}/'
|
||||||
|
, function(Application $app, Request $request, $sbas_id, $record_id)
|
||||||
|
{
|
||||||
|
$Story = new \record_adapter($sbas_id, $record_id);
|
||||||
|
|
||||||
|
$user = $app['Core']->getAuthenticatedUser();
|
||||||
|
|
||||||
|
$em = $app['Core']->getEntityManager();
|
||||||
|
|
||||||
|
$repository = $em->getRepository('\Entities\StoryWZ');
|
||||||
|
|
||||||
|
/* @var $repository \Repositories\StoryWZRepository */
|
||||||
|
$StoryWZ = $repository->findUserStory($user, $Story);
|
||||||
|
|
||||||
|
if (!$StoryWZ)
|
||||||
|
{
|
||||||
|
throw new \Exception_NotFound('Story not found');
|
||||||
|
}
|
||||||
|
$em->remove($StoryWZ);
|
||||||
|
|
||||||
|
$em->flush();
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'success' => true
|
||||||
|
, 'message' => _('Story detached from the WorkZone')
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($request->getRequestFormat() == 'json')
|
||||||
|
{
|
||||||
|
$datas = $app['Core']['Serializer']->serialize($data, 'json');
|
||||||
|
|
||||||
|
return new Response($datas, 200, array('Content-type' => 'application/json'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new RedirectResponse('/');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
return $controllers;
|
return $controllers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -77,8 +77,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div title="" class="context-menu-item">
|
<div title="" class="context-menu-item">
|
||||||
<div class="context-menu-item-inner" onclick="reorder({{basket.getId()}});return false;">
|
<div class="context-menu-item-inner">
|
||||||
{% trans 'Re-ordonner' %}
|
<a class="dialog" title="{% trans 'Re-ordonner' %}" href="/prod/baskets/{{basket.getId()}}/reorder/">
|
||||||
|
{% trans 'Re-ordonner' %}
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -130,14 +132,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div title="" class="context-menu-item">
|
<div title="" class="context-menu-item menu3-custom-item">
|
||||||
<div id="UNFIX_{{story.getId()}}" class="context-menu-item-inner" onclick="unFix(this);return false;">
|
<div class="context-menu-item-inner">
|
||||||
{% trans 'action::detacher' %}
|
<a class="story_unfix" href="/prod/WorkZone/detachStory/{{story.getRecord().get_sbas_id()}}/{{story.getRecord().get_record_id()}}/">
|
||||||
|
{% trans 'action::detacher' %}
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div title="" class="context-menu-item">
|
<div title="" class="context-menu-item menu3-custom-item">
|
||||||
<div class="context-menu-item-inner" onclick="reorder('STORY',{{story.getRecord().get_serialize_key()}});return false;">
|
<div class="context-menu-item-inner">
|
||||||
{% trans 'Re-ordonner' %}
|
<a class="dialog" title="{% trans 'Re-ordonner' %}" href="/prod/story/{{story.getRecord().get_sbas_id()}}/{{story.getRecord().get_record_id()}}/reorder/">
|
||||||
|
{% trans 'Re-ordonner' %}
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@@ -5,6 +5,18 @@
|
|||||||
$('a.dialog').live('click', function(event){
|
$('a.dialog').live('click', function(event){
|
||||||
|
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
|
|
||||||
|
|
||||||
|
$('#DIALOG').attr('title', $this.attr('title'))
|
||||||
|
.empty().addClass('loading')
|
||||||
|
.dialog({
|
||||||
|
resizable:false,
|
||||||
|
closeOnEscape:true,
|
||||||
|
modal:true,
|
||||||
|
width:'800',
|
||||||
|
height:'500'
|
||||||
|
})
|
||||||
|
.dialog('open');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
@@ -14,11 +26,8 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
success: function(data){
|
success: function(data){
|
||||||
$('#DIALOG').attr('title', $this.attr('title'))
|
$('#DIALOG').removeClass('loading').empty()
|
||||||
.empty()
|
.append(data);
|
||||||
.append(data)
|
|
||||||
.dialog()
|
|
||||||
.dialog('open');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -26,8 +35,6 @@
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}())
|
}())
|
@@ -536,38 +536,29 @@ var p4 = p4 || {};
|
|||||||
|
|
||||||
var baskets = {};
|
var baskets = {};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function unFix(el)
|
|
||||||
{
|
|
||||||
var id = $(el).attr('id').split('_').slice(1,2).pop();
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: "/prod/prodFeedBack.php",
|
|
||||||
data: {
|
|
||||||
action: "UNFIX",
|
|
||||||
lst:id
|
|
||||||
},
|
|
||||||
success: function(data){
|
|
||||||
$('#SSTT_'+id).next().droppable('destroy').remove();
|
|
||||||
$('#SSTT_'+id).droppable('destroy').remove();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function fix()
|
function fix()
|
||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/prod/prodFeedBack.php",
|
url: "/prod/WorkZone/attachStories/",
|
||||||
|
data:{stories:p4.Results.Selection.get()},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: {
|
|
||||||
action: "FIX",
|
|
||||||
lst:p4.Result.Selection.serialize()
|
|
||||||
},
|
|
||||||
success: function(data){
|
success: function(data){
|
||||||
if(data.length>0)
|
humane.info(data.message);
|
||||||
refreshBaskets(data.pop());
|
p4.WorkZone.refresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function unfix(link)
|
||||||
|
{
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: link,
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data){
|
||||||
|
humane.info(data.message);
|
||||||
|
p4.WorkZone.refresh();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -575,6 +566,12 @@ var p4 = p4 || {};
|
|||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
activeBaskets();
|
activeBaskets();
|
||||||
|
|
||||||
|
$('#baskets a.story_unfix').live('click', function(){
|
||||||
|
unfix($(this).attr('href'));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
p4.WorkZone = {
|
p4.WorkZone = {
|
||||||
'Selection':new Selectable({selector : '.CHIM', container:$('#baskets')}),
|
'Selection':new Selectable({selector : '.CHIM', container:$('#baskets')}),
|
||||||
'refresh':refreshBaskets,
|
'refresh':refreshBaskets,
|
||||||
|
@@ -490,6 +490,11 @@ function afterSearch()
|
|||||||
cursorAt: {
|
cursorAt: {
|
||||||
top:-10,
|
top:-10,
|
||||||
left:-20
|
left:-20
|
||||||
|
},
|
||||||
|
start:function(event, ui)
|
||||||
|
{
|
||||||
|
if(!$(this).hasClass('selected'))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
linearize();
|
linearize();
|
||||||
@@ -3152,235 +3157,6 @@ function reverse_order()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function save_order()
|
|
||||||
{
|
|
||||||
var ssel_id = $('#reorder_box form[name=save] input[name=ssel_id]').val();
|
|
||||||
var forms = $('#reorder_box .diapo form');
|
|
||||||
|
|
||||||
var n = 1;
|
|
||||||
var datas_order = {};
|
|
||||||
|
|
||||||
forms.each(function(i,el){
|
|
||||||
var val = $('input[name=id]',el).val()+' ';
|
|
||||||
var base_id = $('input[name=base_id]',el).val();
|
|
||||||
var record_id = $('input[name=record_id]',el).val();
|
|
||||||
|
|
||||||
if(val == '')
|
|
||||||
return;
|
|
||||||
datas_order[val] = {
|
|
||||||
order:n,
|
|
||||||
base_id : base_id,
|
|
||||||
record_id : record_id
|
|
||||||
};
|
|
||||||
n++;
|
|
||||||
});
|
|
||||||
|
|
||||||
var options = {
|
|
||||||
ssel_id : ssel_id,
|
|
||||||
value : JSON.stringify(datas_order),
|
|
||||||
action : 'SAVE_ORDER_DATAS'
|
|
||||||
};
|
|
||||||
|
|
||||||
$.post("prodFeedBack.php"
|
|
||||||
, options
|
|
||||||
, function(data){
|
|
||||||
return p4.WorkZone.refresh('current');
|
|
||||||
return;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function reorder(ssel_id)
|
|
||||||
{
|
|
||||||
var buttons = {};
|
|
||||||
|
|
||||||
buttons[language.valider] = function(){
|
|
||||||
save_order();
|
|
||||||
$("#reorder_dialog").dialog('close');
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
$("#reorder_dialog")
|
|
||||||
.dialog({
|
|
||||||
autoOpen:false,
|
|
||||||
closeOnEscape:true,
|
|
||||||
resizable:false,
|
|
||||||
draggable:false,
|
|
||||||
modal:true,
|
|
||||||
buttons:buttons,
|
|
||||||
width:700,
|
|
||||||
height:500,
|
|
||||||
overlay: {
|
|
||||||
backgroundColor: '#000',
|
|
||||||
opacity: 0.7
|
|
||||||
},
|
|
||||||
close:function(){}
|
|
||||||
}).dialog('open');
|
|
||||||
|
|
||||||
$.get("/prod/baskets/"+ssel_id+"/reorder/"
|
|
||||||
, function(data){
|
|
||||||
$('#reorder_box').removeClass('loading');
|
|
||||||
var cont = $("#reorder_box");
|
|
||||||
cont.empty().append(data)
|
|
||||||
.sortable({
|
|
||||||
appendTo : $("#reorder_box"),
|
|
||||||
placeholder: 'diapo ui-sortable-placeholder',
|
|
||||||
distance:20,
|
|
||||||
cursorAt: {
|
|
||||||
top:10,
|
|
||||||
left:-20
|
|
||||||
},
|
|
||||||
items:'div.diapo',
|
|
||||||
scroll:true,
|
|
||||||
scrollSensitivity:40,
|
|
||||||
scrollSpeed:30,
|
|
||||||
start:function(event, ui){
|
|
||||||
var selected = $('.selected',cont);
|
|
||||||
|
|
||||||
selected.each(function(i,n){
|
|
||||||
$(n).attr('position',i);
|
|
||||||
});
|
|
||||||
|
|
||||||
var n = selected.length - 1;
|
|
||||||
|
|
||||||
$('.selected:visible', cont).hide();
|
|
||||||
|
|
||||||
while(n > 0)
|
|
||||||
{
|
|
||||||
$('<div style="height:130px;" class="diapo ui-sortable-placeholderfollow"></div>').insertAfter($('.diapo.ui-sortable-placeholder', cont));
|
|
||||||
n--;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
stop:function(event, ui){
|
|
||||||
|
|
||||||
$('.diapo.ui-sortable-placeholderfollow', cont).remove();
|
|
||||||
|
|
||||||
var main_id = $(ui.item[0]).attr('id');
|
|
||||||
|
|
||||||
var selected = $('.selected',cont);
|
|
||||||
var sorter = new Array();
|
|
||||||
|
|
||||||
|
|
||||||
selected.each(function(i,n){
|
|
||||||
|
|
||||||
var position = parseInt($(n).attr('position'));
|
|
||||||
|
|
||||||
if(position !== '')
|
|
||||||
{
|
|
||||||
sorter[position] = $(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
var id = $(n).attr('id');
|
|
||||||
if(id == main_id)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
var before = true;
|
|
||||||
var last_moved = $(ui.item[0]);
|
|
||||||
$(sorter).each(function(i,n){
|
|
||||||
$(n).show().removeAttr('position');
|
|
||||||
if($(n).attr('id') == main_id)
|
|
||||||
{
|
|
||||||
before = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(before)
|
|
||||||
$(n).insertBefore($(ui.item[0]));
|
|
||||||
else
|
|
||||||
$(n).insertAfter($(last_moved));
|
|
||||||
|
|
||||||
}
|
|
||||||
last_moved = sorter[i];
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
|
||||||
change:function(){
|
|
||||||
$('.diapo.ui-sortable-placeholderfollow', cont).remove();
|
|
||||||
|
|
||||||
var n = $('.selected',cont).length - 1 ;
|
|
||||||
while(n > 0)
|
|
||||||
{
|
|
||||||
$('<div style="height:130px;" class="diapo ui-sortable-placeholderfollow"></div>').insertAfter($('.diapo.ui-sortable-placeholder', cont));
|
|
||||||
n--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}).disableSelection();
|
|
||||||
|
|
||||||
$('.diapo', cont).bind('mousedown',function(event){
|
|
||||||
if(!$(this).hasClass('selected') && !is_ctrl_key(event) && !is_shift_key(event))
|
|
||||||
{
|
|
||||||
$('.diapo.selected', cont).removeClass('selected');
|
|
||||||
$('.diapo.last_selected', cont).removeClass('last_selected');
|
|
||||||
$(this).addClass('last_selected selected');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.diapo', cont).bind('click',function(event){
|
|
||||||
if(is_ctrl_key(event))
|
|
||||||
{
|
|
||||||
if($(this).hasClass('selected'))
|
|
||||||
{
|
|
||||||
$(this).removeClass('selected');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$(this).addClass('selected');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(is_shift_key(event) && $('.diapo.last_selected', cont).length!=0)
|
|
||||||
{
|
|
||||||
var lst = $('.diapo', cont);
|
|
||||||
var index1 = $.inArray($('.diapo.last_selected', cont)[0],lst);
|
|
||||||
var index2 = $.inArray($(this)[0],lst);
|
|
||||||
|
|
||||||
if(index2<index1)
|
|
||||||
{
|
|
||||||
var tmp = index1;
|
|
||||||
index1=(index2-1)<0?index2:(index2-1);
|
|
||||||
index2=tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
var stopped = false;
|
|
||||||
if(index2 != -1 && index1 != -1)
|
|
||||||
{
|
|
||||||
var exp = '.diapo:gt('+index1+'):lt('+(index2-index1)+')';
|
|
||||||
|
|
||||||
$.each($(exp, cont),function(i,n){
|
|
||||||
$(n).addClass('selected');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
$(this).addClass('selected');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$('.diapo.selected', cont).removeClass('selected');
|
|
||||||
if($(this).hasClass('selected'))
|
|
||||||
{
|
|
||||||
$(this).removeClass('selected');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$(this).addClass('selected');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$('.diapo.last_selected', cont).removeClass('last_selected');
|
|
||||||
$(this).addClass('last_selected');
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function set_up_feed_box(data)
|
function set_up_feed_box(data)
|
||||||
{
|
{
|
||||||
var $feed_box = $('#modal_feed');
|
var $feed_box = $('#modal_feed');
|
||||||
|
Reference in New Issue
Block a user