mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-02 11:20:52 +02:00
Files Manager: File Info Popup #232
This commit is contained in:
@@ -17,6 +17,9 @@ $.monstra.filesmanager = {
|
|||||||
$(e.currentTarget).attr('data-path')
|
$(e.currentTarget).attr('data-path')
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
$('#filesDirsList').on('click', '.js-file-info', function(e, el){
|
||||||
|
$.monstra.filesmanager.showInfoDialog(e.currentTarget);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
showRenameDialog: function(type, renameFrom, path){
|
showRenameDialog: function(type, renameFrom, path){
|
||||||
@@ -28,7 +31,22 @@ $.monstra.filesmanager = {
|
|||||||
dialog.find('[id$="RenameType"]').hide();
|
dialog.find('[id$="RenameType"]').hide();
|
||||||
dialog.find('#'+ type +'RenameType').show();
|
dialog.find('#'+ type +'RenameType').show();
|
||||||
dialog.modal('show');
|
dialog.modal('show');
|
||||||
}
|
},
|
||||||
|
|
||||||
|
showInfoDialog: function(btnEl){
|
||||||
|
var dialog = $('#fileInfoDialog');
|
||||||
|
dialog.find('.js-dimension-blck').hide();
|
||||||
|
dialog.find('.js-filename').html($(btnEl).attr('data-filename'));
|
||||||
|
dialog.find('.js-filetype').html($(btnEl).attr('data-filetype'));
|
||||||
|
dialog.find('.js-filesize').html($(btnEl).attr('data-filesize'));
|
||||||
|
dialog.find('.js-link').html($(btnEl).attr('data-link'));
|
||||||
|
var dimension = $(btnEl).attr('data-dimension').trim();
|
||||||
|
if (dimension) {
|
||||||
|
dialog.find('.js-dimension').html(dimension);
|
||||||
|
dialog.find('.js-dimension-blck').show();
|
||||||
|
}
|
||||||
|
dialog.modal('show');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
@@ -110,7 +110,13 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (isset($files_list)) foreach ($files_list as $file) { $ext = File::ext($file); ?>
|
<?php if (isset($files_list)) foreach ($files_list as $file) { $ext = File::ext($file); ?>
|
||||||
<?php if ( ! in_array($ext, $forbidden_types)) { ?>
|
<?php if ( ! in_array($ext, $forbidden_types)) {
|
||||||
|
$dimension = '';
|
||||||
|
if (in_array(strtolower($ext), $image_types)) {
|
||||||
|
$dim = getimagesize($files_path. DS .$file);
|
||||||
|
if (isset($dim[0]) && isset($dim[1])) { $dimension = $dim[1] .'x'. $dim[0] .' px'; }
|
||||||
|
}
|
||||||
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td<?php if (isset(File::$mime_types[$ext]) && preg_match('/image/', File::$mime_types[$ext])) echo ' class="image"'?>>
|
<td<?php if (isset(File::$mime_types[$ext]) && preg_match('/image/', File::$mime_types[$ext])) echo ' class="image"'?>>
|
||||||
<?php if (isset(File::$mime_types[$ext]) && preg_match('/image/', File::$mime_types[$ext])) { ?>
|
<?php if (isset(File::$mime_types[$ext]) && preg_match('/image/', File::$mime_types[$ext])) { ?>
|
||||||
@@ -127,6 +133,15 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
|
<button class="btn btn-primary js-file-info"
|
||||||
|
data-filename="<?php echo str_replace('"', '\'', htmlentities($file)); ?>"
|
||||||
|
data-filetype="<?php echo $ext; ?>"
|
||||||
|
data-filesize="<?php echo Number::byteFormat(filesize($files_path. DS .$file)); ?>"
|
||||||
|
data-dimension="<?php echo htmlentities($dimension); ?>"
|
||||||
|
data-link="<?php echo $site_url.'/public/' . $path.$file; ?>"
|
||||||
|
>
|
||||||
|
<?php echo __('Info', 'filesmanager'); ?>
|
||||||
|
</button>
|
||||||
<button class="btn btn-primary js-rename-file" data-filename="<?php echo $file; ?>" data-path="<?php echo $path; ?>">
|
<button class="btn btn-primary js-rename-file" data-filename="<?php echo $file; ?>" data-path="<?php echo $path; ?>">
|
||||||
<?php echo __('Rename', 'filesmanager'); ?>
|
<?php echo __('Rename', 'filesmanager'); ?>
|
||||||
</button>
|
</button>
|
||||||
@@ -191,4 +206,40 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="fileInfoDialog" class="modal fade" tabindex="-1">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<div class="close" data-dismiss="modal">×</div>
|
||||||
|
<h4 class="modal-title"><?php echo __('File Information', 'filesmanager'); ?></h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3"><?php echo __('Filename:', 'filesmanager'); ?></div>
|
||||||
|
<div class="col-md-9 js-filename"></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3"><?php echo __('Filetype:', 'filesmanager'); ?></div>
|
||||||
|
<div class="col-md-9 js-filetype"></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3"><?php echo __('Filesize:', 'filesmanager'); ?></div>
|
||||||
|
<div class="col-md-9 js-filesize"></div>
|
||||||
|
</div>
|
||||||
|
<div class="row js-dimension-blck">
|
||||||
|
<div class="col-md-3"><?php echo __('Dimension:', 'filesmanager'); ?></div>
|
||||||
|
<div class="col-md-9 js-dimension"></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3"><?php echo __('Link:', 'filesmanager'); ?></div>
|
||||||
|
<div class="col-md-9 js-link"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo __('Cancel', 'filesmanager'); ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
Reference in New Issue
Block a user