more work on fancy theme and mime-icons from bootstrap, thought PHP GD unfortunately does NOT support SVG, so we can not include a type-icon into thumbnails

This commit is contained in:
ralf 2024-08-27 19:15:25 +02:00
parent 039acf1569
commit d1726937f7
8 changed files with 107 additions and 30 deletions

View File

@ -57,9 +57,10 @@ export class Et2Favorites extends Et2DropdownButton implements et2_INextmatchHea
}
et2-image {
display: flex;
height: 100%;
width: ${egwIsMobile() ? css`4ex` : css`2ex`}
position: absolute;
left: 12px;
width: ${egwIsMobile() ? css`4ex` : css`20px`};
font-size: ${egwIsMobile() ? css`4ex` : css`20px`};
}
et2-image[src="trash"] {

View File

@ -194,9 +194,15 @@ export class Et2VfsMime extends Et2ImageExpose
{
this.mime = _value.mime;
}
this.label = '';
if(_value.path)
{
this.href = _value.path;
const parts = _value.path.split('.');
if (parts.length > 1)
{
this.label = egw.lang('%1 File', parts.pop())
}
}
if(_value.download_url)
{

View File

@ -118,6 +118,11 @@ egw.extend('images', egw.MODULE_GLOBAL, function()
_name = split[1];
}
}
// do NOT find old mime128-icons, if not translated to bootstrap
if (_name.startsWith('mime128_'))
{
return null;
}
tries[_app + (_app == 'phpgwapi' ? " (current app)" : "")] = _name;
if (typeof images[_app] != 'undefined' && typeof images[_app][_name] == 'string')
{

View File

@ -44,7 +44,7 @@ class Image
'arrow_right' => 'caret-right-fill',
'arrow_up' => 'caret-up-fill',
'back' => 'forward',
'bullet' => 'record-circle',
'bullet' => /*'record-*/ 'circle',
'cake' => 'cake2',
'calendar' => 'calendar3',
'call' => 'telephone',
@ -72,7 +72,7 @@ class Image
'down' => 'forward',
//'download' => 'download',
'drop' => 'paperclip',
'edit' => 'pencil-fill',
'edit' => 'pencil-square',
'edit_leaf' => 'pencil-square',
'editpaste' => 'clipboard2-data',
'export' => 'download',
@ -103,8 +103,62 @@ class Image
'menu_active' => 'forward',
'menu_list' => 'list-task',
'milestone' => 'check2-circle',
'mime128_application_pdf' => 'file-earmark-pdf',
'mime128_directory' => 'folder2',
'mime128_unknown' => 'file-earmark',
'mime128_application_octet-stream' => 'file-earmark-binary',
'mime128_message_rfc822' => 'envelope-at',
'mime128_text_plain' => 'file-earmark-text',
'mime128_text_html' => 'filetype-html',
'mime128_text_css' => 'filetype-css',
'mime128_text_csv' => 'filetype-csv',
'mime128_text_x-python' => 'filetype-py',
'mime128_text_x-markdown' => 'filetype-md',
//'mime128_text_x-vcard' => '', // todo
//'mime128_text_calendar' => '', // todo
'mime128_application_pdf' => 'filetype-pdf',
'mime128_application_javascript' => 'filetype-js',
'mime128_application_rtf' => 'file-earmark-richtext',
'mime128_application_xml' => 'filetype-xml',
'mime128_application_x-egroupware-etemplate' => 'file-earmark-code',
'mime128_application_msword' => 'filetype-doc',
'mime128_application_zip' => 'file-earmark-zip',
'mime128_application_x-gtar' => 'file-earmark-zip',
'mime128_application_x-gzip' => 'file-earmark-zip',
'mime128_application_x-tar' => 'file-earmark-zip',
'mime128_application_x-bzip2' => 'file-earmark-zip',
'mime128_application_x-7z-compressed' => 'file-earmark-zip',
'mime128_application_x-rar-compressed' => 'file-earmark-zip',
'mime128_application_x-httpd-php' => 'filetype-php',
'mime128_application_json' => 'filetype-json',
'mime128_application_yaml' => 'filetype-yml',
'mime128_application_postscript' => 'filetype-ai',
'mime128_application_vnd.ms-excel' => 'filetype-xls',
'mime128_application_vnd.ms-powerpoint' => 'filetype-ppt',
'mime128_application_vnd.oasis.opendocument.presentation' => 'file-earmark-slides', // todo
'mime128_application_vnd.oasis.opendocument.spreadsheet' => 'file-earmark-spreadsheet', // todo
'mime128_application_vnd.oasis.opendocument.text' => 'file-earmark-word', // todo
'mime128_application_vnd.openxmlformats-officedocument.presentationml.presentation' => 'filetype-pptx',
//'mime128_application_vnd.openxmlformats-officedocument.presentationml.slideshow' => '',
'mime128_application_vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'filetype-xlsx',
'mime128_application_vnd.openxmlformats-officedocument.wordprocessingml.document' => 'filetype-docx',
'mime128_application_x-sh' => 'filetype-sh',
'mime128_application_x-sql' => 'filetype-sql',
'mime128_video' => 'file-earmark-play',
'mime128_video_mp4' => 'filetype-mp4',
'mime128_video_mov' => 'filetype-mov',
//'mime128_video_ogg' => '',
'mime128_image' => 'file-earmark-image',
'mime128_image_bmp' => 'filetype-bmp',
'mime128_image_jpeg' => 'filetype-jpg',
'mime128_image_png' => 'filetype-png',
'mime128_image_gif' => 'filetype-gif',
'mime128_image_svg' => 'filetype-svg',
'mime128_image_tiff' => 'filetype-tiff',
'mime128_image_vnd.adobe.photoshop' => 'filetype-psd',
'mime128_image_vnd.adobe.illustrator' => 'filetype-ai',
'mime128_audio' => 'file-earmark-music',
'mime128_audio_mp4' => 'filetype-mp4',
'mime128_audio_x-wav' => 'filetype-wav',
'minus' => 'dash-lg',
'month' => 'calendar-month',
'mouse_scroll_lr' => 'arrows',
@ -183,9 +237,9 @@ class Image
'dhtmlxtree/close' => 'caret-down',
'dhtmlxtree/folderClosed' => 'folder2',
'dhtmlxtree/folderOpen' => 'folder2-open',
'dhtmlxtree/kfm_home' => 'upload',
'dhtmlxtree/kfm_home' => 'download',
'dhtmlxtree/MailFolderClosed' => 'folder2',
'dhtmlxtree/MailFolderDrafts' => 'floppy',
'dhtmlxtree/MailFolderDrafts' => 'pencil-square',
'dhtmlxtree/MailFolderHam' => 'envelope-check',
'dhtmlxtree/MailFolderJunk' => 'exclamation-octagon',
'dhtmlxtree/MailFolderOutbox' => 'upload',
@ -354,16 +408,21 @@ class Image
{
$url = $webserver_url.$image_map['vfs'][$image.$extension];
}
// then our globals lookup table $global2bootstrap, but not for $app/navbar
elseif(($image !== 'navbar' || $app === 'api') && (isset($image_map['global'][$app.'/'.$image]) || isset($image_map['global'][$image])))
{
$image = $image_map['global'][$app.'/'.$image] ?? $image_map['global'][$image];
}
// return mime128_* not found in bootstrap as not found
elseif(str_starts_with($image, 'mime128_') && !isset($image_map['global'][$image]))
{
return null;
}
// then app specific ones
elseif(isset($image_map[$app][$image.$extension]))
{
$url = $webserver_url.$image_map[$app][$image.$extension];
}
// then our globals lookup table $img2bootstrap
elseif(isset($image_map['global'][$image]))
{
$image = $image_map['global'][$image];
}
if (isset($url))
{
// keep it

View File

@ -4212,7 +4212,7 @@ button.shortcut-buttons-flatpickr-button {
z-index: 790 !important;
}
/* Fix tinemce toolbar z-index is way higher (safari only) */
/* Fix tinymce toolbar z-index is way higher (safari only) */
.tox .tox-editor-container .tox-editor-header {
z-index: auto;
}
@ -4225,6 +4225,11 @@ et2-vfs-select-dialog.egw_app_merge_document et2-checkbox {
et2-vfs-mime {
position: relative;
font-size: 22px !important;
}
et2-vfs-mime img {
width: auto !important;
display: inline-block;
}
et2-vfs-mime img.overlay {
position: absolute;

View File

@ -105,13 +105,12 @@ function get_maxsize()
function read_thumbnail($src)
{
//Check whether the source file is readable and exists
if (!file_exists($src) || !Vfs::is_readable($src))
if (!file_exists($src) || !(is_readable($src) || Vfs::is_readable($src)))
{
return false;
}
// Get the maxsize of an thumbnail. If thumbnailing is turned off, the value
// will be 0
// Get the maxsize of a thumbnail. If thumbnail is turned off, the value will be 0
$maxsize = get_maxsize();
if (isset($_GET['thheight']) && (int)$_GET['thheight'] > 0)
{
@ -138,15 +137,6 @@ function read_thumbnail($src)
// had been successfully created (the cache class used in gen_dstfile does that).
$stat = Vfs::stat(Vfs::parse_url($src, PHP_URL_PATH));
// if pdf-thumbnail-creation is not available, generate a single scaled-down pdf-icon
if ($stat && Vfs::mime_content_type($src) == 'application/pdf' && !pdf_thumbnails_available())
{
list($app, $icon) = explode('/', Vfs::mime_icon('application/pdf'), 2);
list(, $path) = explode($GLOBALS['egw_info']['server']['webserver_url'],
Api\Image::find($app, $icon), 2);
$src = EGW_SERVER_ROOT.$path;
$stat = false;
}
$dst = gen_dstfile($stat && !empty($stat['url']) ? $stat['url'] : $src, $maxsize, $height, $width, $minsize);
$dst_dir = dirname($dst);
if(!file_exists($dst_dir) && !mkdir($dst_dir, 0700, true))
@ -156,7 +146,7 @@ function read_thumbnail($src)
if(file_exists($dst_dir))
{
// Check whether the destination file already exists and is newer than
// the source file. Assume the file doesn't exist if thumbnailing is turned off.
// the source file. Assume the file doesn't exist if thumbnail is turned off.
$exists = file_exists($dst) && filemtime($dst) >= filemtime($src);
// Only generate the thumbnail if the destination file does not match the
// conditions mentioned above. Abort if $maxsize is 0.
@ -177,7 +167,7 @@ function read_thumbnail($src)
$output_mime = 'image/png';
// If some error occured during thumbnail generation or thumbnailing is turned off,
// If some error occurred during thumbnail generation or thumbnail is turned off,
// simply output the mime type icon
if (!$exists)
{
@ -186,6 +176,8 @@ function read_thumbnail($src)
list(, $path) = explode($GLOBALS['egw_info']['server']['webserver_url'],
Api\Image::find($app, $icon), 2);
$dst = EGW_SERVER_ROOT.$path;
$_GET['thsize'] = 22;
return read_thumbnail($dst);
if (function_exists('mime_content_type'))
{
$output_mime = mime_content_type($dst);
@ -199,7 +191,7 @@ function read_thumbnail($src)
if ($dst)
{
// Allow client to cache these, makes scrolling in filemanager much nicer
// setting maximum allow caching time of one year, if url contains (non-empty) moditication time
// setting maximum allow caching time of one year, if url contains (non-empty) modification time
Api\Session::cache_control(empty($_GET['mtime']) ? 300 : 31536000, true); // true = private / browser only caching
header('Content-Type: '.$output_mime);
readfile($dst);
@ -393,7 +385,7 @@ function gd_image_load($file,$maxw,$maxh)
$mime = Vfs::mime_content_type($file);
$tag_image = null;
corner_tag($thumb, $tag_image, $mime);
imagedestroy($tag_image);
if ($tag_image) imagedestroy($tag_image);
}
return $thumb;
}
@ -506,6 +498,7 @@ function corner_tag(&$target_image, &$tag_image, $mime)
list($app, $icon) = explode('/', Vfs::mime_icon($mime), 2);
list(, $path) = explode($GLOBALS['egw_info']['server']['webserver_url'],
Api\Image::find($app, $icon), 2);
if (str_ends_with($path, '.svg')) return;
$dst = EGW_SERVER_ROOT.$path;
$tag_image = imagecreatefrompng($dst);
}

View File

@ -7216,3 +7216,6 @@ img.et2_button_icon[src*="svg"]:hover {
border: 1px solid;
border-radius: var(--sl-border-radius-pill);
}
.nextmatch_header .header_count {
border-radius: var(--sl-border-radius-medium);
}

View File

@ -25,3 +25,8 @@
}
}
}
// styling of legacy NM parts
.nextmatch_header .header_count {
border-radius: var(--sl-border-radius-medium);
}