Snippets

Jonathan Hult Oracle Documents - Online File Viewer

Created by Jonathan Hult last modified
{
	"id": "AppOnlineFileViewer",
	"name": "APP_ONLINE_FILE_VIEWER",
	"description": "APP_ONLINE_FILE_VIEWER_DESC",
	"category": "CUSTOM",
	"supportEmail": "oracle@jonathanhult.com",
	"baseUrl": "",
	"actions": [
		{
			"id": "viewWithOfficeOnline",
			"name": "VIEW_WITH_OFFICE_ONLINE",
			"description": "VIEW_WITH_OFFICE_ONLINE_DESC",
			"type": "UI",
			"presentation": {
				"view": "POPUP",
				"popupWidth": 8000,
				"popupHeight": 8000
			},
			"evaluate": "type=='file' && (_.contains(['doc','docx','docm','dotm','dotx','pptx','ppsx','ppt','pps','pptm','potm','ppam','potx','ppsm'], extension) && (item.size / 1024) < 10000) || (_.contains(['xlsx','xlsb','xls','xlsm'], extension) && (item.size / 1024) < 5000)",
			"invoke": {
				"method": "GET",
				"url": "https://view.officeapps.live.com/op/view.aspx?src={_.pick(location, 'origin').origin}/documents/link/app/{appLink.id}/file/{item.id}?dAppLinkAccessToken={appLink.accessToken}",
				"appLinkRole": "downloader"
			},
			"multi": false,
			"trigger": "MENU"
		},
		{
			"id": "viewWithGoogleDocs",
			"name": "VIEW_WITH_GOOGLE_DOCS",
			"description": "VIEW_WITH_GOOGLE_DOCS_DESC",
			"type": "UI",
			"presentation": {
				"view": "POPUP",
				"popupWidth": 8000,
				"popupHeight": 8000
			},
			"trigger": "MENU",
			"evaluate": "type=='file' && _.contains(['pdf'], extension)",
			"invoke": {
				"method": "GET",
				"url": "https://docs.google.com/viewer?url={_.pick(location, 'origin').origin}/documents/link/app/{appLink.id}/file/{item.id}?dAppLinkAccessToken={appLink.accessToken}",
				"appLinkRole": "downloader"
			},
			"multi": false
		}
	],
	"stringsMap": {
		"en": {
			"APP_ONLINE_FILE_VIEWER": "Online File Viewer",
			"APP_ONLINE_FILE_VIEWER_DESC": "View file online with either 'Office Online' or 'Google Docs'.",
			"VIEW_WITH_OFFICE_ONLINE": "View with Office Online",
			"VIEW_WITH_OFFICE_ONLINE_DESC": "View document using Office Online.",
			"VIEW_WITH_GOOGLE_DOCS": "View with Google Docs",
			"VIEW_WITH_GOOGLE_DOCS_DESC": "View document using Google Docs viewer."
		}
	}
}

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.