// MERGE with 1.4 r7770

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7776 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-07-28 09:20:57 +00:00
parent df255f66c1
commit a875fecb20
968 changed files with 26082 additions and 3937 deletions
+37
View File
@@ -29,6 +29,9 @@ include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
class AdminAttachments extends AdminTab
{
private $_productAttachements = array();
public function __construct()
{
$this->table = 'attachment';
@@ -128,4 +131,38 @@ class AdminAttachments extends AdminTab
</fieldset>
</form>';
}
public function getList($id_lang, $orderBy = NULL, $orderWay = NULL, $start = 0, $limit = NULL)
{
parent::getList((int)$id_lang, $orderBy, $orderWay, $start, $limit);
if(sizeof($this->_list))
$this->_productAttachements = Attachment::getProductAttached((int)$id_lang, $this->_list);
}
protected function _displayDeleteLink($token = NULL, $id)
{
global $currentIndex;
$_cacheLang['Delete'] = $this->l('Delete');
$_cacheLang['DeleteItem'] = $this->l('Delete item #', __CLASS__, TRUE, FALSE);
if (isset($this->_productAttachements[$id]))
{
$productList = '';
foreach($this->_productAttachements[$id] as $product)
$productList .= $product.', ';
}
echo '
<script>
function confirmProductAttached(productList)
{
if (confirm(\''.$_cacheLang['DeleteItem'].$id.'\'))
return confirm(\''.$this->l('This attachment is used by the following products:').'\r\n\' + productList);
return false;
}
</script>
<a href="'.$currentIndex.'&'.$this->identifier.'='.$id.'&delete'.$this->table.'&token='.($token!=NULL ? $token : $this->token).'"
onclick="'.(isset($this->_productAttachements[$id]) ? 'return confirmProductAttached(\''.$productList.'\')' : 'return confirm(\''.$_cacheLang['DeleteItem'].$id.' ?'.(!is_null($this->specificConfirmDelete) ? '\r'.rtrim($this->specificConfirmDelete, ', ') : '').'\')' ).'">
<img src="../img/admin/delete.gif" alt="'.$_cacheLang['Delete'].'" title="'.$_cacheLang['Delete'].'" /></a>';
}
}