-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Use IAppManager to determine dicomviewer app path in filesystem - Fix the issue with opening DICOM files in 2 or more level directories - Add "Open with DICOM Viewer" option at folder level - Support loading extensionless DICOM files when a folder is opened with "Open with DICOM Viewer" option
- Loading branch information
1 parent
f4fc3c4
commit e69cb86
Showing
8 changed files
with
149 additions
and
47 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,18 @@ | ||
const AppIcon = ` | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" | ||
viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve"> | ||
<style type="text/css"> | ||
.st0{fill:#969696;} | ||
.st1{font-family:'MyriadPro-Bold';} | ||
.st2{font-size:10.4869px;} | ||
</style> | ||
<path class="st0" d="M27,7.8c0.3,0.3,0.5,0.7,0.8,1.2c0.3,0.5,0.4,1,0.4,1.4v18.3c0,0.4-0.2,0.8-0.4,1.1c-0.4,0.2-0.7,0.4-1.2,0.4 | ||
H5.3c-0.4,0-0.8-0.2-1.1-0.4c-0.3-0.3-0.4-0.6-0.4-1.1V3.3c0-0.4,0.2-0.8,0.4-1.1s0.6-0.4,1.1-0.4h14.2c0.4,0,0.9,0.1,1.4,0.4 | ||
c0.5,0.3,0.9,0.4,1.2,0.8L27,7.8z M20,3.9v5.9H26c-0.1-0.3-0.2-0.5-0.4-0.6l-5-5C20.6,4.2,20.3,4,20,3.9z M26.1,28.1V11.9h-6.6 | ||
c-0.4,0-0.8-0.2-1.1-0.4c-0.3-0.3-0.4-0.6-0.4-1.1V3.9H5.9v24.3C5.9,28.1,26.1,28.1,26.1,28.1z"/> | ||
<text transform="matrix(0.9036 0 0 1 6.9415 24.9971)" class="st0 st1 st2">dcm</text> | ||
</svg> | ||
`; | ||
|
||
export default AppIcon; |
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,39 @@ | ||
import { registerFileAction, FileAction, FileType, Permission } from '@nextcloud/files'; | ||
import { translate as t } from '@nextcloud/l10n'; | ||
import { generateUrl } from "@nextcloud/router"; | ||
import AppIcon from './AppIcon'; | ||
|
||
function openWithDICOMViewer(node) { | ||
const dicomUrl = window.location.protocol + '//' + window.location.host + generateUrl(`/apps/dicomviewer/dicomjson?file=${node.owner}|${node.fileid}|1`); | ||
|
||
// Open viewer in a new tab | ||
const tab = window.open('about:blank'); | ||
tab.location = generateUrl(`/apps/dicomviewer/ncviewer/viewer/dicomjson?url=${dicomUrl}`); | ||
tab.focus(); | ||
} | ||
|
||
const fileAction = new FileAction({ | ||
id: 'dicomviewer', | ||
order: -10000, | ||
iconSvgInline() { | ||
return AppIcon; | ||
}, | ||
displayName() { | ||
return t('dicomviewer', 'Open with DICOM Viewer'); | ||
}, | ||
enabled(nodes) { | ||
return nodes.length === 1 && (nodes[0].permissions & Permission.READ) !== 0 && nodes[0].type === FileType.Folder; | ||
}, | ||
async execBatch(nodes, view, dir) { | ||
openWithDICOMViewer(nodes[0]); | ||
return Promise.all([Promise.resolve(true)]); | ||
}, | ||
async exec(node, view, dir) { | ||
openWithDICOMViewer(node); | ||
return true; | ||
}, | ||
}); | ||
|
||
export default () => { | ||
registerFileAction(fileAction); | ||
}; |
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