This repository has been archived by the owner on May 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
thinkfree.xml
53 lines (50 loc) · 3.07 KB
/
thinkfree.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<extension>
<title>ThinkFree Extension</title>
<label>ThinkFree</label>
<copyright>Copyright (c) 2006-2009 MindTouch Inc.</copyright>
<description>This extension contains functions for displaying Microsoft Office documents.</description>
<uri.help>http://developer.mindtouch.com/App_Catalog/ThinkFree</uri.help>
<uri.logo>http://scripts.mindtouch.com/logos/thinkfree-logo.png</uri.logo>
<namespace>thinkfree</namespace>
<requires host="MindTouch Core 8.05.1" />
<function>
<name>viewer</name>
<description>View a document.</description>
<param name="document" type="uri">Document uri.</param>
<param name="width" type="num" optional="true">Width of viewer. (default: 90%)</param>
<param name="height" type="num" optional="true">Height of viewer. (default: 425)</param>
<param name="type" type="str" optional="true">Document type (either \"write\", \"calc\", or \"show\"; default: detect automatically)</param>
<return>
<html xmlns:eval="http://mindtouch.com/2007/dekiscript">
<body>
<eval:if test="$type == 'write'"><eval:expr value="iframe($document, $width, $height, 'WRITE_VIEWER')" /></eval:if>
<eval:elseif test="$type == 'calc'"><eval:expr value="iframe($document, $width, $height, 'CALC_VIEWER')" /></eval:elseif>
<eval:elseif test="$type == 'show'"><eval:expr value="iframe($document, $width, $height, 'SHOW_VIEWER')" /></eval:elseif>
<eval:else>
<eval:block value="var parts = uri.parse($document); var last = parts.path[#parts.path-1]; var index = string.lastindexof(last, '.'); var ext = (index >= 0) ? string.substr(last, index + 1) : ''">
<eval:if test="list.contains(['doc', 'docx', 'rtf', 'txt'], ext)"><eval:expr value="iframe($document, $width, $height, 'WRITE_VIEWER')" /></eval:if>
<eval:elseif test="list.contains(['xls', 'xlsx', 'csv'], ext)"><eval:expr value="iframe($document, $width, $height, 'CALC_VIEWER')" /></eval:elseif>
<eval:elseif test="list.contains(['ppt', 'pps', 'pptx', 'ppsx'], ext)"><eval:expr value="iframe($document, $width, $height, 'SHOW_VIEWER')" /></eval:elseif>
<eval:else>ERROR: unable to determine document type, use 'type' argument to specify type</eval:else>
</eval:block>
</eval:else>
</body>
</html>
</return>
</function>
<function>
<access>private</access>
<name>iframe</name>
<param name="document" type="uri" />
<param name="width" type="num" optional="true" />
<param name="height" type="num" optional="true" />
<param name="type" type="str" />
<return>
<html xmlns:eval="http://mindtouch.com/2007/dekiscript">
<body>
<iframe eval:src="'http://viewer.thinkfree.com/view.jsp?app=' .. $type .. '&open=' .. uri.encode($document)" eval:width="web.size($width ?? 0.9)" eval:height="web.size($height ?? 425)" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" />
</body>
</html>
</return>
</function>
</extension>