forked from kitodo/kitodo-production
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kitodo#6269 from thomaslow/open-page-in-separate-b…
…rowser-window-fix-5887 Open media in separate browser window
- Loading branch information
Showing
9 changed files
with
246 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/ExternalView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* (c) Kitodo. Key to digital objects e. V. <[email protected]> | ||
* | ||
* This file is part of the Kitodo project. | ||
* | ||
* It is licensed under GNU General Public License version 3 or later. | ||
* | ||
* For the full copyright and license information, please read the | ||
* GPL3-License.txt file that was distributed with this source code. | ||
*/ | ||
|
||
package org.kitodo.production.forms.dataeditor; | ||
|
||
import java.util.Objects; | ||
|
||
import javax.enterprise.context.RequestScoped; | ||
import javax.inject.Named; | ||
|
||
/** | ||
* Bean that is used in externalView.xhtml. | ||
*/ | ||
@Named("ExternalView") | ||
@RequestScoped | ||
public class ExternalView { | ||
|
||
/** | ||
* Return the shortened ID of the media by removing leading zeros. | ||
* | ||
* @param id the long id of the media file as string | ||
* @return the shortened id of the media file | ||
*/ | ||
public static String convertToShortId(String id) { | ||
if (Objects.nonNull(id)) { | ||
return id.replaceFirst("^0+(?!$)", ""); | ||
} else { | ||
return "-"; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<!-- | ||
* | ||
* (c) Kitodo. Key to digital objects e. V. <[email protected]> | ||
* | ||
* This file is part of the Kitodo project. | ||
* | ||
* It is licensed under GNU General Public License version 3 or later. | ||
* | ||
* For the full copyright and license information, please read the | ||
* GPL3-License.txt file that was distributed with this source code. | ||
* | ||
--> | ||
|
||
<ui:composition | ||
template="/WEB-INF/templates/base.xhtml" | ||
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" | ||
xmlns:f="http://xmlns.jcp.org/jsf/core" | ||
xmlns:fn="http://xmlns.jcp.org/jsp/jstl/functions" | ||
xmlns:h="http://xmlns.jcp.org/jsf/html" | ||
xmlns:p="http://primefaces.org/ui"> | ||
|
||
<f:metadata> | ||
<!--@elvariable id="id" type="java.lang.Integer"--> | ||
<f:viewParam name="processId"/> | ||
<!--@elvariable id="mediaId" type="java.lang.String"--> | ||
<f:viewParam name="mediaId"/> | ||
<!--@elvariable id="mimeType" type="java.lang.String"--> | ||
<f:viewParam name="mimeType"/> | ||
<!--@elvariable id="cachingUUID" type="java.lang.String"--> | ||
<f:viewParam name="cachingUUID"/> | ||
</f:metadata> | ||
|
||
<ui:define name="search"> | ||
<h2 id="externalViewTitle"> | ||
<h:outputText rendered="#{fn:startsWith(mimeType, 'audio')}" value="#{msgs.audio} "/> | ||
<h:outputText rendered="#{fn:startsWith(mimeType, 'video')}" value="#{msgs.video} "/> | ||
<h:outputText rendered="#{fn:startsWith(mimeType, 'image')}" value="#{msgs.image} "/> | ||
<h:outputText value="#{ExternalView.convertToShortId(mediaId)}"> | ||
<f:convertNumber pattern="#" /> | ||
</h:outputText> | ||
</h2> | ||
</ui:define> | ||
|
||
<ui:define name="breadcrumbs"></ui:define> | ||
<ui:define name="navigation"></ui:define> | ||
|
||
<ui:define name="content"> | ||
<p:panel id="externalViewPanel"> | ||
<h:form id="imagePreviewForm" style="height: 100%;" styleClass="focusable"> | ||
<!-- video and audio --> | ||
<ui:fragment rendered="#{fn:startsWith(mimeType, 'video') or fn:startsWith(mimeType, 'audio')}"> | ||
<p:outputPanel id="mediaDetailMediaContainer"> | ||
<p:media | ||
styleClass="mediaPreviewItem" | ||
value="#{mediaProvider.mediaView}" | ||
player="#{fn:startsWith(mimeType, 'video') ? 'html-video' : 'html-audio'}" | ||
width="90%" | ||
height="auto"> | ||
<f:param name="mediaId" value="#{mediaId}"/> | ||
<f:param name="process" value="#{processId}"/> | ||
<f:param name="sessionId" value="#{cachingUUID}"/> | ||
<f:param name="type" value="#{mimeType}"/> | ||
<f:param name="krsc" value="true"/> | ||
</p:media> | ||
</p:outputPanel> | ||
</ui:fragment> | ||
<!-- image --> | ||
<ui:fragment rendered="#{fn:startsWith(mimeType, 'image')}"> | ||
<p:graphicImage | ||
id="mediaPreviewGraphicImage" | ||
value="#{mediaProvider.mediaView}" | ||
styleClass="mediaPreviewItem" | ||
style="display: none;"> | ||
<f:param name="mediaId" value="#{mediaId}"/> | ||
<f:param name="process" value="#{processId}"/> | ||
</p:graphicImage> | ||
|
||
<div id="map" class="map" style="width: 100%; height: 100%;"> | ||
<i class="fa fa-spinner fa-spin"/> | ||
</div> | ||
</ui:fragment> | ||
</h:form> | ||
</p:panel> | ||
|
||
<h:outputStylesheet name="webjars/openlayers/6.14.1/ol.css"/> | ||
<h:outputScript library="webjars" name="openlayers/6.14.1/ol.js" /> | ||
<h:outputScript name="js/ol_custom.js"/> | ||
<h:outputScript> | ||
$(document).ready(function () { | ||
// load openlayers and show image | ||
metadataEditor.detailMap.update(); | ||
}); | ||
</h:outputScript> | ||
</ui:define> | ||
|
||
</ui:composition> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters