Skip to content
Snippets Groups Projects
Commit 447f66e2 authored by Laurent's avatar Laurent
Browse files

dev #65510 clean album edit images screen

parent 4aff1cba
2 merge requests!2366Dev#65510 maj jquery,!2358Dev#65510 maj jquery
Pipeline #2605 failed with stage
in 19 minutes and 29 seconds
......@@ -4,110 +4,109 @@ echo $this->partial('album/_album_panel.phtml',
?>
<table style="border-collapse:collapse;text-align:center">
<tr><td><?php
echo $this->bouton('id=add_link',
'picto=add',
'texte=' . $this->_('Ajouter un media'),
'url=' . $this->url(['action' => 'add-ressource',
'id' => $this->album->getId()]),
'largeur=250px;');
?>
</td>
<td>
<?php
echo $this->tagUploadMultiple('albumRessourcesUpload',
$this->traduire('Ajouter des medias'),
['modelClass' => 'Class_Album',
'modelId' => $this->album->getId()]);
?>
</td>
echo $this->button_New((new Class_Entity())
->setText($this->_('Ajouter un media'))
->setUrl($this->url(['action' => 'add-ressource',
'id' => $this->album->getId()])));
?>
</td>
<td>
<?php
echo $this->tagUploadMultiple('albumRessourcesUpload',
$this->traduire('Ajouter des medias'),
['modelClass' => 'Class_Album',
'modelId' => $this->album->getId()]);
?>
</td>
</tr>
</table>
<center>
<div class="form" style="text-align:center;">
<?php if ($this->ressources) { ?>
<div class="form" style="text-align:center;">
<?php if ($this->ressources) { ?>
<fieldset>
<legend><?php echo $this->traduire('Gérer les medias'); ?></legend>
<?php
echo $this->tagAnchor(['action' => 'sortressources'],
sprintf('%s Réordonner par nom de fichier',
Class_Admin_Skin::current()->renderActionIconOn('sort',
$this,
['alt' => 'Trier ce media',
'title' => 'Trier ce media',
'class' => 'sort-handler'])),
['class' => 'sort_ressources']);
?>
<button class="bouton switchview"><?php echo $this->traduire('Changer la disposition'); ?></button>
<div class='clear'></div>
<script type="text/javascript">
$(function() {
$('.tree')
<legend><?php echo $this->traduire('Gérer les medias'); ?></legend>
<?php
echo $this->tagAnchor(['action' => 'sortressources'],
sprintf('%s Réordonner par nom de fichier',
Class_Admin_Skin::current()->renderActionIconOn('sort',
$this,
['alt' => 'Trier ce media',
'title' => 'Trier ce media',
'class' => 'sort-handler'])),
['class' => 'sort_ressources']);
?>
<button class="bouton switchview"><?php echo $this->traduire('Changer la disposition'); ?></button>
<div class='clear'></div>
<script type="text/javascript">
$(function() {
$('.tree')
.sortable({
opacity: 0.6,
handle: '.sort-handler',
stop: function(event, ui) {
var sourceId = parseInt(ui.item.attr('id'));
var previousId = 0;
if (0 < ui.item.prev().length) {
previousId = parseInt(ui.item.prev().first().attr('id'));
}
$.ajax({url: baseUrl+'/admin/album/move-image/id/' + sourceId
+ '/after/' + previousId});
}
})
opacity: 0.6,
handle: '.sort-handler',
stop: function(event, ui) {
var sourceId = parseInt(ui.item.attr('id'));
var previousId = 0;
if (0 < ui.item.prev().length) {
previousId = parseInt(ui.item.prev().first().attr('id'));
}
$.ajax({url: baseUrl+'/admin/album/move-image/id/' + sourceId
+ '/after/' + previousId});
}
})
.disableSelection();
$('.switchview').click(function() {$('fieldset ul.tree').toggleClass('thumbwall')})
});
function toggleMediaSelection() {
var hasChecked = false;
$('input.mass_deletion').each(function(i, item) {
$(item).parents('li').css('background-color',
(item.checked) ? 'lightgrey' : 'transparent');
if (item.checked) hasChecked = true;
});
if (hasChecked)
$('.mass_actions').show();
else
$('.mass_actions').hide();
}
function extractMediaCheckedIds() {
var ids = '';
$('input.mass_deletion:checked').each(function(i, item){
ids = ids + $(item).val() + ',';
});
return ids;
}
function fireMediaMassDeletion() {
var count = $('input.mass_deletion:checked').size();
if (0 == count) {
return false;
}
if (!confirm((1 < count)
? '<?php echo $this->_('Êtes-vous sûr de vouloir supprimer ces %s medias ?');?>'.replace('%s', count)
: '<?php echo $this->_('Êtes-vous sûr de vouloir supprimer ce media ?');?>')) {
return false;
}
//the real work
$.ajax('<?php echo $this->url(['action' => 'mass-ressource-delete']);?>',
{
data: {ids: extractMediaCheckedIds()},
complete: function(){window.location.reload(true);},
async: false
});
return false;
}
</script>
<div style="float:right;width:100%;text-align:right;margin:5px 0;">
<span class="mass_actions" style="display:none;">
$('.switchview').click(function() {$('fieldset ul.tree').toggleClass('thumbwall')})
});
function toggleMediaSelection() {
var hasChecked = false;
$('input.mass_deletion').each(function(i, item) {
$(item).parents('li').css('background-color',
(item.checked) ? 'lightgrey' : 'transparent');
if (item.checked) hasChecked = true;
});
if (hasChecked)
$('.mass_actions').show();
else
$('.mass_actions').hide();
}
function extractMediaCheckedIds() {
var ids = '';
$('input.mass_deletion:checked').each(function(i, item){
ids = ids + $(item).val() + ',';
});
return ids;
}
function fireMediaMassDeletion() {
var count = $('input.mass_deletion:checked').size();
if (0 == count) {
return false;
}
if (!confirm((1 < count)
? '<?php echo $this->_('Êtes-vous sûr de vouloir supprimer ces %s medias ?');?>'.replace('%s', count)
: '<?php echo $this->_('Êtes-vous sûr de vouloir supprimer ce media ?');?>')) {
return false;
}
//the real work
$.ajax('<?php echo $this->url(['action' => 'mass-ressource-delete']);?>',
{
data: {ids: extractMediaCheckedIds()},
complete: function(){window.location.reload(true);},
async: false
});
return false;
}
</script>
<div style="float:right;width:100%;text-align:right;margin:5px 0;">
<span class="mass_actions" style="display:none;">
<?php
$current_skin = Class_Admin_Skin::current();
$actionLabel = $this->_('Supprimer les médias sélectionnés');
......@@ -116,30 +115,30 @@ echo $this->tagUploadMultiple('albumRessourcesUpload',
$current_skin->renderActionIconOn('delete', $this,
['alt' => '',
'style' => 'vertical-align:middle'])
. $actionLabel,
['onclick' => "return fireMediaMassDeletion();"]);
. $actionLabel,
['onclick' => "return fireMediaMassDeletion();"]);
?>
</span>
<input type="checkbox"
onclick="$('input.mass_deletion').attr('checked', this.checked);toggleMediaSelection();"
title="Tout sélectionner" value="1" class="all_mass_deletions">
</div>
<ul class="tree">
</span>
<input type="checkbox"
onclick="$('input.mass_deletion').attr('checked', this.checked);toggleMediaSelection();"
title="Tout sélectionner" value="1" class="all_mass_deletions">
</div>
<ul class="tree">
<?php foreach ($this->ressources as $ressource) { ?>
<li class="ressource" id="<?php echo $ressource->getId();?>">
<div style="width:50px;"><?php
if ($ressource->isImage() || $ressource->hasPoster()) {
echo sprintf('<a rel="prettyPhoto" href="%s" title="%s">%s</a>',
($ressource->isImage()) ? $ressource->getOriginalUrl() : $ressource->getPosterUrl(),
$ressource->getTitre(),
$this->tagImg($ressource->getThumbnailUrl(),
['style' => 'width:50px']));
}
?></div>
if ($ressource->isImage() || $ressource->hasPoster()) {
echo sprintf('<a rel="prettyPhoto" href="%s" title="%s">%s</a>',
($ressource->isImage()) ? $ressource->getOriginalUrl() : $ressource->getPosterUrl(),
$ressource->getTitre(),
$this->tagImg($ressource->getThumbnailUrl(),
['style' => 'width:50px']));
}
?></div>
<div class="info">
<?php echo $this->albumRessourceInfos($ressource) ?>
</div>
<?php echo $this->albumRessourceInfos($ressource) ?>
</div>
<div class="actions">
<?php
......@@ -166,23 +165,20 @@ echo $this->tagUploadMultiple('albumRessourcesUpload',
['onclick' => "return confirm('Êtes-vous sûr de vouloir supprimer ce media ?');"]);
?>
<input type="checkbox" class="mass_deletion"
value="<?php echo $ressource->getId();?>" name="mass_delete[]"
title="Sélectionner ce média" onclick="toggleMediaSelection(this);">
value="<?php echo $ressource->getId();?>" name="mass_delete[]"
title="Sélectionner ce média" onclick="toggleMediaSelection(this);">
</div>
</li>
<?php } ?>
</ul>
</fieldset>
<?php } ?>
</div>
<?php } ?>
</ul>
</fieldset>
<?php } ?>
<?php
echo $this->bouton('id=c_2',
'picto=back',
'texte=Retour',
'url=' . $this->url(['controller' => 'album',
'action' => 'index',
'cat_id' => $this->album->getCatId()]),
'largeur=120px');
echo $this->button_Back((new Class_Entity())
->setText($this->_('Retour'))
->setUrl($this->url(['controller' => 'album',
'action' => 'index',
'cat_id' => $this->album->getCatId()])));
?>
</center>
</div>
......@@ -21,21 +21,24 @@
class ZendAfi_View_Helper_TagUploadMultiple extends ZendAfi_View_Helper_BaseHelper {
/**
* @param string $name
* @param string $buttonLabel
* @param string $button_label
* @param array $args
* @return string
*/
public function tagUploadMultiple($name, $buttonLabel, Array $args) {
public function tagUploadMultiple($name, $button_label, Array $args) {
return $this->getJavaScript($name, $args)
. $this->view->bouton('id=mass_upload',
'picto=add_category',
'texte=' . $buttonLabel,
'javascript=load_' . $name . '();',
'largeur=250px')
. $this->view->button((new Class_Entity())
->setText($button_label)
->setId('mass_upload')
->setImage($this->view->tagImg(Class_Admin_Skin::current()
->getIconUrl('actions', 'add_category'),
['style' => 'filter: invert();']))
->setAttribs(['onclick' => 'load_' . $name . '();']))
. '<div id="' . $name . '_conteneur"></div>';
}
/**
* @param string $name
* @param array $args
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment