Merge remote-tracking branch 'mike/master' into dev

This commit is contained in:
Mario Vavti 2017-11-17 09:14:16 +01:00
commit becd5f1446
7 changed files with 59 additions and 10 deletions

View File

@ -197,6 +197,11 @@ class Browser extends DAV\Browser\Plugin {
}
}
// generate preview icons for tile view.
// Currently we only handle images, but this could potentially be extended with plugins
// to provide document and video thumbnails
$photo_icon = '';
if(strpos($type,'image/') === 0 && $attachHash) {
@ -206,8 +211,12 @@ class Browser extends DAV\Browser\Plugin {
intval(PHOTO_RES_PROFILE_80)
);
if($r) {
$photo_icon = $r[0]['resource_id'] . '-' . $r[0]['imgscale'];
$photo_icon = 'photo/' . $r[0]['resource_id'] . '-' . $r[0]['imgscale'];
}
if($type === 'image/svg+xml') {
$photo_icon = $fullPath;
}
}
$attachIcon = ""; // "<a href=\"attach/".$attachHash."\" title=\"".$displayName."\"><i class=\"fa fa-arrow-circle-o-down\"></i></a>";

View File

@ -53,7 +53,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'STD_VERSION', '2.9' );
define ( 'ZOT_REVISION', '1.3' );
define ( 'DB_UPDATE_VERSION', 1197 );
define ( 'DB_UPDATE_VERSION', 1198 );
define ( 'PROJECT_BASE', __DIR__ );

View File

@ -31,7 +31,6 @@ function z_mime_content_type($filename) {
'txt' => 'text/plain',
'htm' => 'text/html',
'html' => 'text/html',
'php' => 'text/html',
'css' => 'text/css',
'md' => 'text/markdown',
'bb' => 'text/bbcode',
@ -41,8 +40,17 @@ function z_mime_content_type($filename) {
'swf' => 'application/x-shockwave-flash',
'flv' => 'video/x-flv',
'epub' => 'application/epub+zip',
'c' => 'text/plain',
'h' => 'text/plain',
'sh' => 'text/plain',
'py' => 'text/plain',
'php' => 'text/plain',
'rb' => 'text/plain',
'pdl' => 'text/plain',
// images
'png' => 'image/png',
'jpe' => 'image/jpeg',
'jpeg' => 'image/jpeg',
@ -73,9 +81,7 @@ function z_mime_content_type($filename) {
'flac' => 'audio/flac',
'opus' => 'audio/ogg',
'webm' => 'video/webm',
// 'webm' => 'audio/webm',
'mp4' => 'video/mp4',
// 'mp4' => 'audio/mp4',
'mkv' => 'video/x-matroska',
// adobe

View File

@ -2710,6 +2710,9 @@ function getIconFromType($type) {
'application/octet-stream' => 'fa-file-o',
//Text
'text/plain' => 'fa-file-text-o',
'text/markdown' => 'fa-file-text-o',
'text/bbcode' => 'fa-file-text-o',
'text/html' => 'fa-file-text-o',
'application/msword' => 'fa-file-word-o',
'application/pdf' => 'fa-file-pdf-o',
'application/vnd.oasis.opendocument.text' => 'fa-file-word-o',
@ -2739,11 +2742,33 @@ function getIconFromType($type) {
'video/x-matroska' => 'fa-file-video-o'
);
$iconFromType = 'fa-file-o';
$catMap = [
'application' => 'fa-file-code-o',
'multipart' => 'fa-folder',
'audio' => 'fa-file-audio-o',
'video' => 'fa-file-video-o',
'text' => 'fa-file-text-o',
'image' => 'fa=file-picture-o',
'message' => 'fa-file-text-o'
];
$iconFromType = '';
if (array_key_exists($type, $iconMap)) {
$iconFromType = $iconMap[$type];
}
else {
$parts = explode('/',$type);
if($parts[0] && $catMap[$parts[0]]) {
$iconFromType = $catMap[$parts[0]];
}
}
if(! $iconFromType) {
$iconFromType = 'fa-file-o';
}
return $iconFromType;
}

View File

@ -609,7 +609,6 @@ CREATE TABLE IF NOT EXISTS `item` (
`resource_type` char(16) NOT NULL DEFAULT '',
`attach` mediumtext NOT NULL,
`sig` text NOT NULL,
`diaspora_meta` mediumtext NOT NULL,
`location` char(191) NOT NULL DEFAULT '',
`coord` char(191) NOT NULL DEFAULT '',
`public_policy` char(191) NOT NULL DEFAULT '',

View File

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1197 );
define( 'UPDATE_VERSION' , 1198 );
/**
*
@ -3060,3 +3060,13 @@ function update_r1196() {
return UPDATE_FAILED;
}
function update_r1197() {
$r = q("select diaspora_meta from item where true limit 1");
if($r) {
$r = q("ALTER TABLE item DROP diaspora_meta");
}
return UPDATE_SUCCESS;
}

View File

@ -16,7 +16,7 @@
<div class="cloud-container">
<div class="cloud-icon"><a href="{{$item.fullPath}}">
{{if $item.photo_icon}}
<img src="photo/{{$item.photo_icon}}" title="{{$item.type}}" >
<img src="{{$item.photo_icon}}" title="{{$item.type}}" >
{{else}}
<i class="fa fa-fw {{$item.iconFromType}}" title="{{$item.type}}"></i>
{{/if}}