[svn r10648] add the possibility to delete a photo in Image Manager

skala
Julian Prud'homme 19 years ago
parent 21258cf2c4
commit a448cf1df8
  1. 26
      main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/ImageManager.php
  2. 2
      main/inc/lib/fckeditor/editor/plugins/ImageManager/config.inc.php
  3. BIN
      main/inc/lib/fckeditor/editor/plugins/ImageManager/icon.gif
  4. 3
      main/inc/lib/fckeditor/editor/plugins/ImageManager/images.php

@ -408,6 +408,28 @@ class ImageManager
}
function _deletePictureInDatabase($relative){
$path = "/images/".substr($relative,1);
$dbDocumentTable = Database::get_course_table(TABLE_DOCUMENT);
$dbItemPropertyTable = Database::get_course_table(TABLE_ITEM_PROPERTY);
//Select the id of the picture to delete
$sql="SELECT id FROM ".$dbDocumentTable." WHERE path='".$path."'";
$result=api_sql_query($sql);
$image_id=mysql_result($result,0,0);
//Delete the picture in the documents table
$sql="DELETE FROM ".$dbDocumentTable." WHERE id='".$image_id."'";
$result=api_sql_query($sql);
//Delete the picture in the item_property table
$sql="DELETE FROM ".$dbItemPropertyTable." WHERE ref='".$image_id."'";
$result=api_sql_query($sql);
}
/**
* Process upload files. The file must be an
@ -561,8 +583,10 @@ class ImageManager
*/
function deleteFiles()
{
if(isset($_GET['delf']))
if(!empty($_GET['delf'])){
$this->_delFile(rawurldecode($_GET['delf']));
$this->_deletePictureInDatabase(rawurldecode($_GET['delf']));
}
}
/**

@ -148,7 +148,7 @@ $IMConfig['allow_replace'] = false;
FALSE - No deleting allowed
*/
$IMConfig['allow_delete'] = false;
$IMConfig['allow_delete'] = true;
/*
Possible values: true, false

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -60,7 +60,8 @@ function drawFiles($list, &$manager)
<?php if($IMConfig['allow_delete'] == true) { ?>
<a href="images.php?dir=<?php echo $relative; ?>&amp;delf=<?php echo rawurlencode($file['relative']);?>" title="Trash" onclick="return confirmDeleteFile('<?php echo $entry; ?>');"><img src="img/edit_trash.gif" height="15" width="15" alt="Trash"/></a>
<?php } ?>
<a href="javascript:;" title="Edit" onclick="editImage('<?php echo rawurlencode($file['relative']);?>');"><img src="img/edit_pencil.gif" height="15" width="15" alt="Edit"/></a>
<!--EDIT IMAGE ; TEMPORALY DELETED-->
<!--<a href="javascript:;" title="Edit" onclick="editImage('<?php echo rawurlencode($file['relative']);?>');"><img src="img/edit_pencil.gif" height="15" width="15" alt="Edit"/></a>-->
<?php if($file['image']){ echo $file['image'][0].'x'.$file['image'][1]; } else echo $entry;?>
</td></tr></table></td>
<?php

Loading…
Cancel
Save