addition of remove img option in adminPrivateSalesSales
This commit is contained in:
parent
2d10e1b167
commit
b4ff3a8ee5
@ -33,6 +33,7 @@ class AdminPrivateSalesSales extends AdminTab {
|
||||
echo '<script type="text/javascript" src="'.__PS_BASE_URI__.'modules/privatesales/privatesale.js"></script>
|
||||
<script type="text/javascript">
|
||||
i18n_delete = "'.$this->l('Are you sure you want to delete this sale?').'";
|
||||
i18n_delete_img = "'.$this->l('Are you sure you want to delete this image?').'";
|
||||
current_location = "'.$currentIndex.'&token='.Tools::getAdminTokenLite('AdminPrivateSalesSales').'";
|
||||
</script>
|
||||
<script type="text/javascript" src="'.__PS_BASE_URI__.'modules/privatesales/jquery.multiSelect.js"></script>
|
||||
@ -482,7 +483,11 @@ class AdminPrivateSalesSales extends AdminTab {
|
||||
<input type="file" name="img_'.$k.'_'.$language['id_lang'].'" />
|
||||
<p>'.$this->l('Size:').' '.$v[1].'</p>';
|
||||
if($this->cursale !== NULL && file_exists(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$this->cursale->id.'/'.$k.'_'.$language['id_lang'].'.jpg')) {
|
||||
echo '<p><a href="'.__PS_BASE_URI__.'modules/privatesales/img/'.$this->cursale->id.'/'.$k.'_'.$language['id_lang'].'.jpg" onclick="window.open(this.href); return false;"> '.$this->l('Preview').'</a></p>';
|
||||
$imgName = $k.'_'.$language['id_lang'];
|
||||
echo '<p>
|
||||
<a href="'.__PS_BASE_URI__.'modules/privatesales/img/'.$this->cursale->id.'/'.$k.'_'.$language['id_lang'].'.jpg" onclick="window.open(this.href); return false;"> '.$this->l('Preview').'</a>
|
||||
<img style="cursor: pointer;" onclick="ImgDeletion('.$this->cursale->id.', \''.$imgName.'\')" title="Supprimer cette image" alt="" src="../img/admin/delete.gif">
|
||||
</p>';
|
||||
}
|
||||
echo '
|
||||
</div>';
|
||||
@ -909,6 +914,13 @@ class AdminPrivateSalesSales extends AdminTab {
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif(isset($_GET['deleteImg']) && $id_sale = Tools::getValue('id') && $image = Tools::getValue('image')) {
|
||||
if(file_exists(_PS_ROOT_DIR_.'/modules/privatesales/img/'.(int)Tools::getValue('id').'/'.$image.'.jpg')){
|
||||
unlink(_PS_ROOT_DIR_.'/modules/privatesales/img/'.(int)Tools::getValue('id').'/'.$image.'.jpg');
|
||||
Tools::redirectAdmin($currentIndex.'&token='.Tools::getAdminTokenLite('AdminPrivateSalesSales').'&edit&id='.(int)Tools::getValue('id'));
|
||||
} else {
|
||||
echo $this->displayError($this->l('This image doesn\'t exist.'));
|
||||
}
|
||||
} elseif(isset($_GET['delete']) && $id_sale = Tools::getValue('id')) {
|
||||
Sale::deleteSale($id_sale);
|
||||
Tools::redirectAdmin($currentIndex.'&token='.Tools::getAdminTokenLite('AdminPrivateSalesSales'));
|
||||
|
@ -3,8 +3,15 @@ function itemEdition(linkId) {
|
||||
}
|
||||
|
||||
function itemDeletion(linkId) {
|
||||
var ok = confirm(i18n_delete)
|
||||
var ok = confirm(i18n_delete)
|
||||
if(ok == true) {
|
||||
document.location.href = current_location + "&id=" + linkId + "&delete=1";
|
||||
}
|
||||
}
|
||||
|
||||
function ImgDeletion(linkId, ImgId) {
|
||||
var ok = confirm(i18n_delete_img)
|
||||
if(ok == true) {
|
||||
document.location.href = current_location + "&id=" + linkId + "&delete=1";
|
||||
document.location.href = current_location + "&deleteImg=1&image=" + ImgId + "&id=" + linkId;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user