Skip to content
Snippets Groups Projects
Commit 1ca04cfb authored by srosse's avatar srosse
Browse files

OO-2328: image in PDF with context like /olat, show the type of media in the metadata

parent 38d4870f
No related branches found
No related tags found
No related merge requests found
Showing
with 30 additions and 7 deletions
......@@ -32,6 +32,7 @@ import org.olat.core.util.Formatter;
import org.olat.core.util.StringHelper;
import org.olat.modules.portfolio.Category;
import org.olat.modules.portfolio.Media;
import org.olat.modules.portfolio.MediaHandler;
import org.olat.modules.portfolio.PortfolioService;
import org.olat.modules.portfolio.manager.MetadataXStream;
import org.olat.user.UserManager;
......@@ -67,6 +68,14 @@ public class MediaMetadataController extends BasicController {
metaVC.contextPut("media", media);
String author = userManager.getUserDisplayName(media.getAuthor());
metaVC.contextPut("author", author);
MediaHandler handler = portfolioService.getMediaHandler(media.getType());
String type = translate("artefact." + handler.getType());
metaVC.contextPut("mediaType", type);
String iconCssClass = handler.getIconCssClass(media);
if(StringHelper.containsNonWhitespace(iconCssClass)) {
metaVC.contextPut("mediaIconCssClass", iconCssClass);
}
if(media.getCollectionDate() != null) {
String collectionDate = Formatter.getInstance(getLocale()).formatDate(media.getCollectionDate());
......
<table class="table table-condensed table-striped"><tbody>
#if($r.isNotEmpty($mediaType))
<tr><th>$r.translate("table.header.type")</th>
<td>#if($r.isNotEmpty($mediaIconCssClass))<i class="o_icon $mediaIconCssClass"> </i> #end $r.escapeHtml($mediaType)</td></tr>
#end
#if($r.isNotEmpty($author))
<tr><th>$r.translate("author")</th>
<td>$r.escapeHtml($author)</td></tr>
......
......@@ -55,6 +55,7 @@ import org.olat.core.gui.render.velocity.VelocityRenderDecorator;
import org.olat.core.gui.translator.Translator;
import org.olat.core.gui.util.SyntheticUserRequest;
import org.olat.core.gui.util.WindowControlMocker;
import org.olat.core.helpers.Settings;
import org.olat.core.logging.OLog;
import org.olat.core.logging.Tracing;
import org.olat.core.util.FileUtils;
......@@ -323,7 +324,12 @@ public class ExportBinderAsPDFResource implements MediaResource {
}
}
private String processMedia(final String src) {
private String processMedia(String src) {
String serverContext = Settings.getServerContextPath();
if(serverContext != null && serverContext.length() > 1 && src.startsWith(serverContext)) {
src = src.substring(serverContext.length(), src.length());
}
if(!src.startsWith(DispatcherModule.PATH_MAPPED)) return null;
String subInfo = src.substring(DispatcherModule.PATH_MAPPED.length());
......
......@@ -390,6 +390,10 @@
border: 1px $o-portfolio-media-content-background-color solid;
border-radius: $o-panel-placeholder-border-radius;
}
.o_artefact_metadata {
text-align: left;
}
}
}
......
This diff is collapsed.
source diff could not be displayed: it is too large. Options to address this: view the blob.
source diff could not be displayed: it is too large. Options to address this: view the blob.
This diff is collapsed.
source diff could not be displayed: it is too large. Options to address this: view the blob.
source diff could not be displayed: it is too large. Options to address this: view the blob.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment