Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
1e4ec2ac
Commit
1e4ec2ac
authored
11 years ago
by
Georg Ehrke
Browse files
Options
Downloads
Patches
Plain Diff
add class='preview-icon' to rows in file app that make use of previews
parent
e01bc7de
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
apps/files/templates/part.list.php
+10
-2
10 additions, 2 deletions
apps/files/templates/part.list.php
lib/preview.php
+17
-1
17 additions, 1 deletion
lib/preview.php
lib/public/preview.php
+11
-27
11 additions, 27 deletions
lib/public/preview.php
with
38 additions
and
30 deletions
apps/files/templates/part.list.php
+
10
−
2
View file @
1e4ec2ac
...
...
@@ -34,9 +34,17 @@ $totalsize = 0; ?>
<?php
$relativePath
=
substr
(
$relativePath
,
strlen
(
$_
[
'sharingroot'
]));
?>
style=
"background-image:url(
<?php
print_unescaped
(
OCP\publicPreview_icon
(
$relativePath
,
$_
[
'sharingtoken'
]));
?>
)"
<?php
if
(
\OCP\Preview
::
isMimeSupported
(
$file
[
'mimetype'
]))
:
?>
style=
"background-image:url(
<?php
print_unescaped
(
OCP\publicPreview_icon
(
$relativePath
,
$_
[
'sharingtoken'
]));
?>
)"
class=
"preview-icon"
<?php
else
:
?>
style=
"background-image:url(
<?php
print_unescaped
(
OCP\preview_icon
(
$relativePath
));
?>
)"
style=
"background-image:url(
<?php
print_unescaped
(
OCP\mimetype_icon
(
$file
[
'mimetype'
]));
?>
)"
<?php
endif
;
?>
<?php
else
:
?>
<?php
if
(
\OCP\Preview
::
isMimeSupported
(
$file
[
'mimetype'
]))
:
?>
style=
"background-image:url(
<?php
print_unescaped
(
OCP\preview_icon
(
$relativePath
));
?>
)"
class=
"preview-icon"
<?php
else
:
?>
style=
"background-image:url(
<?php
print_unescaped
(
OCP\mimetype_icon
(
$file
[
'mimetype'
]));
?>
)"
<?php
endif
;
?>
<?php
endif
;
?>
<?php
endif
;
?>
>
...
...
This diff is collapsed.
Click to expand it.
lib/preview.php
+
17
−
1
View file @
1e4ec2ac
...
...
@@ -772,6 +772,22 @@ class Preview {
$preview
->
deleteAllPreviews
();
}
public
static
function
isMimeSupported
(
$mimetype
)
{
//check if there are preview backends
if
(
empty
(
self
::
$providers
))
{
self
::
initProviders
();
}
//remove last element because it has the mimetype *
$providers
=
array_slice
(
self
::
$providers
,
0
,
-
1
);
foreach
(
$providers
as
$supportedmimetype
=>
$provider
)
{
if
(
preg_match
(
$supportedmimetype
,
$mimetype
))
{
return
true
;
}
}
return
false
;
}
private
static
function
showErrorPreview
()
{
$path
=
\OC
::
$SERVERROOT
.
'/core/img/actions/delete.png'
;
$preview
=
new
\OC_Image
(
$path
);
...
...
This diff is collapsed.
Click to expand it.
lib/public/preview.php
+
11
−
27
View file @
1e4ec2ac
<?php
/**
* ownCloud
*
* @author Frank Karlitschek
* @copyright 2012 Frank Karlitschek frank@owncloud.org
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright (c) 2013 Frank Karlitschek frank@owncloud.org
* Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
/**
* Public interface of ownCloud for apps to use.
* Preview Class.
*
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace
OCP
;
/**
...
...
@@ -47,4 +25,10 @@ class Preview {
return
(
\OC_Preview
::
show
(
$file
,
$maxX
,
$maxY
,
$scaleup
));
}
public
static
function
isMimeSupported
(
$mimetype
=
'*'
)
{
return
\OC\Preview
::
isMimeSupported
(
$mimetype
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment