* fix for add doc image delete.

This commit is contained in:
wangyidong
2017-02-14 10:30:54 +08:00
parent 29b4f4f531
commit 4a398b0e42
2 changed files with 13 additions and 6 deletions
+11 -3
View File
@@ -90,14 +90,22 @@
}
echo $content;
?>
<div class='list-group files-list'>
<?php foreach($doc->files as $file):?>
<?php if(in_array($file->extension, $config->file->imageExtensions)):?>
<a href="<?php echo $file->webPath?>" target="_blank">
<img onload="setImageSize(this,0)" src="<?php echo $file->webPath?>" alt="<?php echo $file->title?>" title="<?php echo $file->title?>">
</a>
<?php $uploadDate = $lang->file->uploadDate . substr($file->addedDate, 0, 10);?>
<li class='list-group-item' title='<?php echo $uploadDate?>' style='position:relative;'>
<a href="<?php echo $file->webPath?>" target="_blank">
<img onload="setImageSize(this,0)" src="<?php echo $file->webPath?>" alt="<?php echo $file->title?>">
</a>
<span class='right-icon' style='position:absolute;right:-18px;top:0px;'>
<?php if(common::hasPriv('file', 'delete')) echo html::a('###', "<i class='icon-remove'></i>", '', "class='btn-icon' onclick='deleteFile($file->id)' title='$lang->delete'");?>
</span>
</li>
<?php unset($doc->files[$file->id]);?>
<?php endif;?>
<?php endforeach;?>
</div>
<?php if($doc->files):?>
<div class='file-content'><?php echo $this->fetch('file', 'printFiles', array('files' => $doc->files, 'fieldset' => 'false'));?></div>
+2 -3
View File
@@ -53,12 +53,11 @@ function downloadFile(fileID, extension, imageWidth)
{
if(common::hasPriv('file', 'download'))
{
$uploadDate = $lang->file->uploadDate . $file->addedDate;
$fileTitle = "<li title={$uploadDate} class='list-group-item'><i class='icon-file-text text-muted icon'></i> &nbsp;" . $file->title .'.' . $file->extension;
$uploadDate = $lang->file->uploadDate . substr($file->addedDate, 0, 10);
$fileTitle = "<li title='{$uploadDate}' class='list-group-item'><i class='icon-file-text text-muted icon'></i> &nbsp;" . $file->title .'.' . $file->extension;
$imageWidth = 0;
if(stripos('jpg|jpeg|gif|png|bmp', $file->extension) !== false)
{
$file = $this->file->getById($file->id);
$imageSize = getimagesize($file->realPath);
$imageWidth = $imageSize ? $imageSize[0] : 0;
}