wirispluginengine 3.62.0.1322 → 7.14.0.1422
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +34 -34
- data/app/assets/javascripts/wirispluginengine/WIRISplugins.js +1040 -64
- data/app/controllers/wirispluginengine/application_controller.rb +84 -75
- data/app/helpers/wirispluginengine/application_helper.rb +4 -4
- data/config/routes.rb +4 -4
- data/lib/com/wiris/common/WInteger.rb +52 -51
- data/lib/com/wiris/plugin/api/Cas.rb +5 -5
- data/lib/com/wiris/plugin/api/CleanCache.rb +5 -5
- data/lib/com/wiris/plugin/api/Configuration.rb +5 -5
- data/lib/com/wiris/plugin/api/ConfigurationKeys.rb +94 -91
- data/lib/com/wiris/plugin/api/Editor.rb +5 -5
- data/lib/com/wiris/plugin/api/Filter.rb +5 -5
- data/lib/com/wiris/plugin/api/ImageFormatController.rb +5 -5
- data/lib/com/wiris/plugin/api/ParamsProvider.rb +5 -5
- data/lib/com/wiris/plugin/api/PluginBuilder.rb +88 -74
- data/lib/com/wiris/plugin/api/Render.rb +5 -5
- data/lib/com/wiris/plugin/api/ServiceResourceLoader.rb +5 -5
- data/lib/com/wiris/plugin/api/Test.rb +5 -5
- data/lib/com/wiris/plugin/api/TextService.rb +5 -5
- data/lib/com/wiris/plugin/configuration/ConfigurationUpdater.rb +5 -5
- data/lib/com/wiris/plugin/impl/CacheFormulaImpl.rb +15 -0
- data/lib/com/wiris/plugin/impl/CacheImpl.rb +124 -0
- data/lib/com/wiris/plugin/impl/CasImpl.rb +140 -138
- data/lib/com/wiris/plugin/impl/CleanCacheImpl.rb +103 -101
- data/lib/com/wiris/plugin/impl/ConfigurationImpl.rb +165 -166
- data/lib/com/wiris/plugin/impl/CustomConfigurationUpdater.rb +32 -30
- data/lib/com/wiris/plugin/impl/DefaultConfigurationUpdater.rb +24 -22
- data/lib/com/wiris/plugin/impl/EditorImpl.rb +80 -78
- data/lib/com/wiris/plugin/impl/FileConfigurationUpdater.rb +29 -27
- data/lib/com/wiris/plugin/impl/FileStorageAndCache.rb +55 -53
- data/lib/com/wiris/plugin/impl/FolderTreeStorageAndCache.rb +65 -134
- data/lib/com/wiris/plugin/impl/GenericParamsProviderImpl.rb +50 -48
- data/lib/com/wiris/plugin/impl/HttpImpl.rb +49 -48
- data/lib/com/wiris/plugin/impl/HttpListener.rb +5 -5
- data/lib/com/wiris/plugin/impl/ImageFormatControllerPng.rb +71 -63
- data/lib/com/wiris/plugin/impl/ImageFormatControllerSvg.rb +37 -28
- data/lib/com/wiris/plugin/impl/PluginBuilderImpl.rb +280 -248
- data/lib/com/wiris/plugin/impl/RenderImpl.rb +303 -257
- data/lib/com/wiris/plugin/impl/ServiceResourceLoaderImpl.rb +41 -39
- data/lib/com/wiris/plugin/impl/TestImpl.rb +177 -157
- data/lib/com/wiris/plugin/impl/TextFilter.rb +210 -194
- data/lib/com/wiris/plugin/impl/TextFilterTags.rb +57 -50
- data/lib/com/wiris/plugin/impl/TextServiceImpl.rb +158 -107
- data/lib/com/wiris/plugin/storage/StorageAndCache.rb +5 -5
- data/lib/com/wiris/util/json/JSon.rb +505 -493
- data/lib/com/wiris/util/json/JSonIntegerFormat.rb +17 -16
- data/lib/com/wiris/util/json/JsonAPIResponse.rb +70 -0
- data/lib/com/wiris/util/json/StringParser.rb +57 -56
- data/lib/com/wiris/util/sys/AccessProvider.rb +8 -0
- data/lib/com/wiris/util/sys/Cache.rb +8 -0
- data/lib/com/wiris/util/sys/HttpConnection.rb +14 -13
- data/lib/com/wiris/util/sys/HttpConnectionListener.rb +5 -5
- data/lib/com/wiris/util/sys/HttpSync.rb +28 -0
- data/lib/com/wiris/util/sys/IniFile.rb +132 -131
- data/lib/com/wiris/util/sys/Lock.rb +8 -0
- data/lib/com/wiris/util/sys/LockProvider.rb +8 -0
- data/lib/com/wiris/util/sys/Store.rb +126 -101
- data/lib/com/wiris/util/sys/StoreCache.rb +63 -0
- data/lib/com/wiris/util/sys/TimerProxy.rb +21 -0
- data/lib/com/wiris/util/sys/TimerTask.rb +8 -0
- data/lib/com/wiris/util/type/Arrays.rb +275 -0
- data/lib/com/wiris/util/type/ByteBuffer.rb +69 -0
- data/lib/com/wiris/util/type/Comparator.rb +8 -0
- data/lib/com/wiris/util/type/DataUtils.rb +24 -0
- data/lib/com/wiris/util/type/DoubleTools.rb +14 -0
- data/lib/com/wiris/util/type/HashCache.rb +43 -0
- data/lib/com/wiris/util/type/IntegerTools.rb +32 -0
- data/lib/com/wiris/util/type/Queue.rb +31 -0
- data/lib/com/wiris/util/type/SortArrayByStringLength.rb +26 -0
- data/lib/com/wiris/util/type/SortStringByLength.rb +26 -0
- data/lib/com/wiris/util/type/SortedHash.rb +45 -0
- data/lib/com/wiris/util/type/Stack.rb +31 -0
- data/lib/com/wiris/util/type/StringUtils.rb +56 -0
- data/lib/com/wiris/util/type/Tokenizer.rb +40 -0
- data/lib/com/wiris/util/type/UrlUtils.rb +78 -0
- data/lib/com/wiris/util/xml/ContentHandler.rb +8 -0
- data/lib/com/wiris/util/xml/DefaultHandler.rb +25 -0
- data/lib/com/wiris/util/xml/EntityResolver.rb +8 -0
- data/lib/com/wiris/util/xml/MathMLEntityResolver.rb +19 -0
- data/lib/com/wiris/util/xml/SAXParser.rb +470 -0
- data/lib/com/wiris/util/xml/SerializableImpl.rb +16 -15
- data/lib/com/wiris/util/xml/WCharacterBase.rb +968 -627
- data/lib/com/wiris/util/xml/WEntities.rb +11 -9
- data/lib/com/wiris/util/xml/WXmlUtils.rb +660 -490
- data/lib/com/wiris/util/xml/XmlSerializer.rb +517 -471
- data/lib/com/wiris/util/xml/XmlWriter.rb +260 -262
- data/lib/loader.rb +15 -12
- data/lib/src-generic/Array.rb +22 -22
- data/lib/src-generic/ArrayInt.rb +31 -31
- data/lib/src-generic/Base64.rb +14 -14
- data/lib/src-generic/BaseCode.rb +93 -93
- data/lib/src-generic/Boolean.rb +27 -0
- data/lib/src-generic/Bytes.rb +50 -50
- data/lib/src-generic/BytesInput.rb +37 -37
- data/lib/src-generic/EReg.rb +55 -55
- data/lib/src-generic/File.rb +35 -35
- data/lib/src-generic/FileLock.rb +26 -26
- data/lib/src-generic/FileSystem.rb +37 -37
- data/lib/src-generic/Hash.rb +42 -42
- data/lib/src-generic/Http.rb +111 -107
- data/lib/src-generic/HttpRequest.rb +25 -25
- data/lib/src-generic/HttpResponse.rb +70 -70
- data/lib/src-generic/Iterator.rb +20 -19
- data/lib/src-generic/Math.rb +14 -14
- data/lib/src-generic/Md5.rb +8 -8
- data/lib/src-generic/Md5Tools.rb +11 -11
- data/lib/src-generic/PropertiesTools.rb +32 -32
- data/lib/src-generic/Reflect.rb +16 -16
- data/lib/src-generic/RubyConfigurationUpdater.rb +49 -45
- data/lib/src-generic/Serializer.rb +84 -84
- data/lib/src-generic/Std.rb +74 -74
- data/lib/src-generic/Storage.rb +152 -152
- data/lib/src-generic/StringBuf.rb +40 -40
- data/lib/src-generic/StringTools.rb +44 -46
- data/lib/src-generic/Timer.rb +6 -6
- data/lib/src-generic/Type.rb +18 -18
- data/lib/src-generic/TypeTools.rb +31 -31
- data/lib/src-generic/Unserializer.rb +72 -72
- data/lib/src-generic/Utf8.rb +26 -26
- data/lib/src-generic/Xml.rb +199 -198
- data/lib/src-generic/extended/Integer.rb +5 -5
- data/lib/src-generic/extended/Math.rb +6 -6
- data/lib/src-generic/extended/Properties.rb +11 -11
- data/lib/src-generic/extended/String.rb +38 -38
- data/lib/src-generic/settings/PlatformSettings.rb +18 -18
- data/lib/src-generic/system/HttpProxy.rb +23 -0
- data/lib/src-generic/system/HttpProxyAuth.rb +10 -0
- data/lib/wirispluginengine.rb +5 -5
- data/lib/wirispluginengine/engine.rb +5 -5
- data/lib/wirispluginengine/integration/cleancache.rb +8 -8
- data/lib/wirispluginengine/integration/configurationjs.rb +8 -15
- data/lib/wirispluginengine/integration/configurationjson.rb +6 -6
- data/lib/wirispluginengine/integration/createimage.rb +7 -7
- data/lib/wirispluginengine/integration/getmathml.rb +18 -18
- data/lib/wirispluginengine/integration/resource.rb +8 -8
- data/lib/wirispluginengine/integration/service.rb +5 -5
- data/lib/wirispluginengine/integration/showimage.rb +28 -21
- data/lib/wirispluginengine/integration/test.rb +5 -5
- data/lib/wirispluginengine/integration/testfilter.rb +10 -0
- data/lib/wirispluginengine/version.rb +2 -2
- data/resources/VERSION +1 -1
- data/resources/WEB-INF/web.xml +25 -0
- data/resources/WIRISplugins.js +3809 -0
- data/resources/default-configuration.ini +47 -45
- data/resources/tech.txt +1 -1
- data/resources/wirisplugin.css +43 -42
- metadata +40 -4
- data/configuration.ini.dist +0 -104
@@ -1,111 +1,113 @@
|
|
1
1
|
module WirisPlugin
|
2
2
|
include Wiris
|
3
|
-
require('com/wiris/plugin/api/ConfigurationKeys.rb')
|
4
|
-
require('com/wiris/
|
5
|
-
require('com/wiris/
|
6
|
-
|
7
|
-
|
3
|
+
require('com/wiris/plugin/api/ConfigurationKeys.rb')
|
4
|
+
require('com/wiris/plugin/api/CleanCache.rb')
|
5
|
+
require('com/wiris/util/json/JSon.rb')
|
6
|
+
require('com/wiris/plugin/api/CleanCache.rb')
|
7
|
+
class CleanCacheImpl
|
8
|
+
extend CleanCacheInterface
|
8
9
|
|
9
|
-
|
10
|
+
include Wiris
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
def init(param)
|
26
|
-
@storage = @plugin::getStorageAndCache()
|
27
|
-
@token = param::getParameter("token",nil)
|
28
|
-
@newToken = param::getParameter("newtoken",nil)
|
29
|
-
@wirisCleanCacheToken = @plugin::getConfiguration()::getProperty(ConfigurationKeys::CLEAN_CACHE_TOKEN,nil)
|
30
|
-
@accept = (param::getParameter("accept",nil)!=nil)&&(param::getParameter("accept","")=="application/json") ? true : false
|
31
|
-
@gui = isGui()
|
32
|
-
@validToken = validateToken(@wirisCleanCacheToken,@token)
|
33
|
-
@cleanCachePath = @plugin::getConfiguration()::getProperty(ConfigurationKeys::CLEAN_CACHE_PATH,"")
|
34
|
-
@resourcePath = @plugin::getConfiguration()::getProperty(ConfigurationKeys::RESOURCE_PATH,"")
|
35
|
-
if (@token!=nil)&&@validToken
|
36
|
-
deleteCache()
|
37
|
-
end
|
38
|
-
end
|
39
|
-
def deleteCache()
|
40
|
-
@storage::deleteCache()
|
41
|
-
end
|
42
|
-
def getCacheOutput()
|
43
|
-
if @gui
|
44
|
-
output = ""
|
45
|
-
output+="<html><head>\r\n"
|
46
|
-
output+="<title>WIRIS plugin clean cache service</title><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" />\r\n"
|
47
|
-
output+=("<link rel=stylesheet type=text/css href="+@resourcePath)+"?resourcefile=wirisplugin.css />"
|
48
|
-
output+="</head>"
|
49
|
-
output+="<div class=wirismaincontainer>"
|
50
|
-
output+="<body class=wirisplugincleancache>"
|
51
|
-
output+="<h2 class=wirisplugincleancache>WIRIS plugin clean cache service</h2>\r\n"
|
52
|
-
output+="<div class=wirisplugincleancacheform>"
|
53
|
-
if @wirisCleanCacheToken!=nil
|
54
|
-
output+=("<form action="+@cleanCachePath)+" method=post>"
|
55
|
-
output+="<span class=wirisplugincleancachetextform> Security token </span><input type=password autocomplete=off name=token>"
|
56
|
-
output+="<input type=\"submit\" value=\"Submit\">"
|
57
|
-
output+="</form>"
|
12
|
+
attr_accessor :plugin
|
13
|
+
attr_accessor :token
|
14
|
+
attr_accessor :newToken
|
15
|
+
attr_accessor :wirisCleanCacheToken
|
16
|
+
attr_accessor :validToken
|
17
|
+
attr_accessor :accept
|
18
|
+
attr_accessor :gui
|
19
|
+
attr_accessor :storage
|
20
|
+
attr_accessor :cleanCachePath
|
21
|
+
attr_accessor :resourcePath
|
22
|
+
def initialize(pb)
|
23
|
+
super()
|
24
|
+
@plugin = pb
|
58
25
|
end
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
if @newToken!=nil
|
72
|
-
output+=" Your new token is: <br>"
|
73
|
-
output+=("<span class=wirisplugincleancachewarning>"+Md5::encode(@newToken).to_s)+"</span> <br>"
|
74
|
-
output+=" Please copy it to your configuration.ini file <br>"
|
75
|
-
output+=" For more information see <a href=http://www.wiris.com/plugins/docs/resources/configuration-table style=text-decoration:none>Server configuration file documentation</a>"
|
26
|
+
def init(param)
|
27
|
+
@storage = @plugin::getStorageAndCache()
|
28
|
+
@token = param::getParameter("token",nil)
|
29
|
+
@newToken = param::getParameter("newtoken",nil)
|
30
|
+
@wirisCleanCacheToken = @plugin::getConfiguration()::getProperty(ConfigurationKeys::CLEAN_CACHE_TOKEN,nil)
|
31
|
+
@accept = (param::getParameter("accept",nil) != nil) && (param::getParameter("accept","") == "application/json") ? true : false
|
32
|
+
@gui = isGui()
|
33
|
+
@validToken = validateToken(@wirisCleanCacheToken,@token)
|
34
|
+
@cleanCachePath = @plugin::getConfiguration()::getProperty(ConfigurationKeys::CLEAN_CACHE_PATH,"")
|
35
|
+
@resourcePath = @plugin::getConfiguration()::getProperty(ConfigurationKeys::RESOURCE_PATH,"")
|
36
|
+
if (@token != nil) && @validToken
|
37
|
+
deleteCache()
|
76
38
|
end
|
77
|
-
end
|
78
39
|
end
|
79
|
-
|
80
|
-
|
81
|
-
return output
|
82
|
-
else
|
83
|
-
jsonOutput = Hash.new()
|
84
|
-
if !@validToken
|
85
|
-
jsonOutput::set("status","error")
|
86
|
-
else
|
87
|
-
jsonOutput::set("status","ok")
|
40
|
+
def deleteCache()
|
41
|
+
@storage::deleteCache()
|
88
42
|
end
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
43
|
+
def getCacheOutput()
|
44
|
+
if @gui
|
45
|
+
output = ""
|
46
|
+
output += "<html><head>\r\n"
|
47
|
+
output += "<title>MathType integration clean cache service</title><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" />\r\n"
|
48
|
+
output += ("<link rel=stylesheet type=text/css href=" + @resourcePath) + "?resourcefile=wirisplugin.css />"
|
49
|
+
output += "</head>"
|
50
|
+
output += "<div class=wirismaincontainer>"
|
51
|
+
output += "<body class=wirisplugincleancache>"
|
52
|
+
output += "<h2 class=wirisplugincleancache>MathType integration clean cache service</h2>\r\n"
|
53
|
+
output += "<div class=wirisplugincleancacheform>"
|
54
|
+
if @wirisCleanCacheToken != nil
|
55
|
+
output += ("<form action=" + @cleanCachePath) + " method=post>"
|
56
|
+
output += "<span class=wirisplugincleancachetextform> Security token </span><input type=password autocomplete=off name=token>"
|
57
|
+
output += "<input type=\"submit\" value=\"Submit\">"
|
58
|
+
output += "</form>"
|
59
|
+
end
|
60
|
+
output += ("<form action=" + @cleanCachePath) + " method=post>"
|
61
|
+
output += "<span class=wirisplugincleancachetextform> Generate token </span> <input type=text name=newtoken>"
|
62
|
+
output += "<input type=\"submit\" value=\"Submit\">"
|
63
|
+
output += "</form>"
|
64
|
+
output += "</div>"
|
65
|
+
output += "<div class=wirisplugincleancacheresults>"
|
66
|
+
if (@token != nil) && !@validToken
|
67
|
+
output += "<span class=wirisplugincleancachewarning> Invalid Token </span>"
|
68
|
+
else
|
69
|
+
if @validToken && (@token != nil)
|
70
|
+
output += "<span class=wirisplugincleancachewarning> Cache deleted successfully </span>"
|
71
|
+
else
|
72
|
+
if @newToken != nil
|
73
|
+
output += " Your new token is: <br>"
|
74
|
+
output += ("<span class=wirisplugincleancachewarning>" + Md5::encode(@newToken).to_s) + "</span> <br>"
|
75
|
+
output += " Please copy it to your configuration.ini file <br>"
|
76
|
+
output += " For more information see <a href=http://www.wiris.com/plugins/docs/resources/configuration-table style=text-decoration:none>Server configuration file documentation</a>"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
output += "</div>"
|
81
|
+
output += "</div>"
|
82
|
+
return output
|
83
|
+
else
|
84
|
+
jsonOutput = Hash.new()
|
85
|
+
if !@validToken
|
86
|
+
jsonOutput::set("status","error")
|
87
|
+
else
|
88
|
+
jsonOutput::set("status","ok")
|
89
|
+
end
|
90
|
+
return JSon::encode(jsonOutput)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
def getContentType()
|
94
|
+
if !@gui
|
95
|
+
return "application/json"
|
96
|
+
else
|
97
|
+
return "text/html charset=UTF-8"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
def validateToken(md5Token, token)
|
101
|
+
if (token != nil) && (md5Token != nil)
|
102
|
+
return (md5Token == Md5Tools::encodeString(token))
|
103
|
+
else
|
104
|
+
return false
|
105
|
+
end
|
106
|
+
end
|
107
|
+
def isGui()
|
108
|
+
wirisCacheGui = (@plugin::getConfiguration()::getProperty(ConfigurationKeys::CLEAN_CACHE_GUI,"false") == "true")
|
109
|
+
return wirisCacheGui && !@accept
|
110
|
+
end
|
111
|
+
|
109
112
|
end
|
110
|
-
end
|
111
113
|
end
|
@@ -1,176 +1,175 @@
|
|
1
1
|
module WirisPlugin
|
2
2
|
include Wiris
|
3
|
-
require('com/wiris/plugin/api/ConfigurationKeys.rb')
|
4
|
-
require('com/wiris/plugin/impl/CustomConfigurationUpdater.rb')
|
5
|
-
require('com/wiris/
|
6
|
-
require('com/wiris/
|
7
|
-
require('com/wiris/plugin/
|
8
|
-
|
9
|
-
|
3
|
+
require('com/wiris/plugin/api/ConfigurationKeys.rb')
|
4
|
+
require('com/wiris/plugin/impl/CustomConfigurationUpdater.rb')
|
5
|
+
require('com/wiris/plugin/api/Configuration.rb')
|
6
|
+
require('com/wiris/util/json/JSon.rb')
|
7
|
+
require('com/wiris/plugin/impl/FileConfigurationUpdater.rb')
|
8
|
+
require('com/wiris/plugin/api/Configuration.rb')
|
9
|
+
class ConfigurationImpl
|
10
|
+
extend ConfigurationInterface
|
10
11
|
|
11
|
-
|
12
|
+
include Wiris
|
12
13
|
|
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
|
-
while iter::hasNext()
|
49
|
-
cu = iter::next()
|
50
|
-
initialize_(cu)
|
51
|
-
cu::updateConfiguration(@props)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
def initialize_(cu)
|
55
|
-
cu::init(@initObject)
|
56
|
-
end
|
57
|
-
def setPluginBuilderImpl(plugin)
|
58
|
-
@plugin = plugin
|
59
|
-
end
|
60
|
-
def appendVarJs(sb,varName,value,comment)
|
61
|
-
sb::add("var ")
|
62
|
-
sb::add(varName)
|
63
|
-
sb::add(" = ")
|
64
|
-
sb::add(value)
|
65
|
-
sb::add("; // ")
|
66
|
-
sb::add(comment)
|
67
|
-
sb::add("\r\n")
|
68
|
-
end
|
69
|
-
def appendElement2JavascriptArray(array,value)
|
70
|
-
arrayOpen = array::indexOf("[")
|
71
|
-
arrayClose = array::indexOf("]")
|
72
|
-
if (arrayOpen==-1)||(arrayClose==-1)
|
73
|
-
raise Exception,"Array not valid"
|
74
|
-
end
|
75
|
-
return ((("["+"\'")+value)+"\'")+(array::length()==2 ? "]" : ","+Std::substr(array,arrayOpen+1,arrayClose-arrayOpen).to_s)
|
76
|
-
end
|
77
|
-
def getJavaScriptConfiguration()
|
78
|
-
sb = StringBuf.new()
|
79
|
-
arrayParse = "[]"
|
80
|
-
appendVarJs(sb,"_wrs_conf_editorEnabled",getProperty("wiriseditorenabled",nil),"Specifies if fomula editor is enabled")
|
81
|
-
appendVarJs(sb,"_wrs_conf_imageMathmlAttribute",("\'"+getProperty("wiriseditormathmlattribute",nil))+"\'","Specifies the image tag where we should save the formula editor mathml code")
|
82
|
-
appendVarJs(sb,"_wrs_conf_saveMode",("\'"+getProperty("wiriseditorsavemode",nil))+"\'","This value can be \'xml\', \'safeXml\', \'image\' or \'base64\'")
|
83
|
-
appendVarJs(sb,"_wrs_conf_editMode",("\'"+getProperty("wiriseditoreditmode",nil))+"\'","This value can be \'default\' or \'image\'")
|
84
|
-
if (getProperty("wiriseditorparselatex",nil)=="true")
|
85
|
-
arrayParse = appendElement2JavascriptArray(arrayParse,"latex")
|
86
|
-
end
|
87
|
-
if (getProperty("wiriseditorparsexml",nil)=="true")
|
88
|
-
arrayParse = appendElement2JavascriptArray(arrayParse,"xml")
|
89
|
-
end
|
90
|
-
appendVarJs(sb,"_wrs_conf_parseModes",arrayParse,"This value can contain \'latex\' and \'xml)")
|
91
|
-
appendVarJs(sb,"_wrs_conf_editorAttributes",("\'"+getProperty("wiriseditorwindowattributes",nil))+"\'","Specifies formula editor window options")
|
92
|
-
appendVarJs(sb,"_wrs_conf_editorUrl",("\'"+@plugin::getImageServiceURL("editor",false))+"\'","WIRIS editor")
|
93
|
-
appendVarJs(sb,"_wrs_conf_modalWindow",getProperty("wiriseditormodalwindow",nil),"Editor modal window")
|
94
|
-
appendVarJs(sb,"_wrs_conf_CASEnabled",getProperty("wiriscasenabled",nil),"Specifies if WIRIS cas is enabled")
|
95
|
-
appendVarJs(sb,"_wrs_conf_CASMathmlAttribute",("\'"+getProperty("wiriscasmathmlattribute",nil))+"\'","Specifies the image tag where we should save the WIRIS cas mathml code")
|
96
|
-
appendVarJs(sb,"_wrs_conf_CASAttributes",("\'"+getProperty("wiriscaswindowattributes",nil))+"\'","Specifies WIRIS cas window options")
|
97
|
-
appendVarJs(sb,"_wrs_conf_hostPlatform",("\'"+getProperty("wirishostplatform",nil))+"\'","Specifies host platform")
|
98
|
-
appendVarJs(sb,"_wrs_conf_versionPlatform",("\'"+getProperty("wirisversionplatform","unknown"))+"\'","Specifies host version platform")
|
99
|
-
appendVarJs(sb,"_wrs_conf_enableAccessibility",getProperty("wirisaccessibilityenabled",nil),"Specifies whether accessibility is enabled")
|
100
|
-
appendVarJs(sb,"_wrs_conf_setSize",getProperty("wiriseditorsetsize",nil),"Specifies whether to set the size of the images at edition time")
|
101
|
-
appendVarJs(sb,"_wrs_conf_editorToolbar",("\'"+getProperty(ConfigurationKeys::EDITOR_TOOLBAR,nil))+"\'","Toolbar definition")
|
102
|
-
appendVarJs(sb,"_wrs_conf_chemEnabled",getProperty("wirischemeditorenabled",nil),"Specifies if WIRIS chem editor is enabled")
|
103
|
-
appendVarJs(sb,"_wrs_conf_imageFormat",("\'"+getProperty("wirisimageformat","png"))+"\'","WIRIS Plugin image format")
|
104
|
-
if getProperty(ConfigurationKeys::EDITOR_PARAMS,nil)!=nil
|
105
|
-
appendVarJs(sb,"_wrs_conf_editorParameters",getProperty(ConfigurationKeys::EDITOR_PARAMS,nil),"Editor parameters")
|
106
|
-
else
|
107
|
-
h = ConfigurationKeys::imageConfigPropertiesInv
|
108
|
-
attributes = StringBuf.new()
|
109
|
-
confVal = ""
|
110
|
-
i = 0
|
111
|
-
it = h::keys()
|
112
|
-
while it::hasNext()
|
113
|
-
value = it::next()
|
114
|
-
if getProperty(value,nil)!=nil
|
115
|
-
if i!=0
|
116
|
-
attributes::add(",")
|
14
|
+
attr_accessor :plugin
|
15
|
+
attr_accessor :initObject
|
16
|
+
attr_accessor :props
|
17
|
+
attr_accessor :initialized
|
18
|
+
def initialize()
|
19
|
+
super()
|
20
|
+
@props = PropertiesTools::newProperties()
|
21
|
+
end
|
22
|
+
def getFullConfiguration()
|
23
|
+
initialize0()
|
24
|
+
return @props
|
25
|
+
end
|
26
|
+
def getProperty(key, dflt)
|
27
|
+
initialize0()
|
28
|
+
return PropertiesTools::getProperty(@props,key,dflt)
|
29
|
+
end
|
30
|
+
def setProperty(key, value)
|
31
|
+
PropertiesTools::setProperty(@props,key,value)
|
32
|
+
end
|
33
|
+
def setInitObject(context)
|
34
|
+
@initObject = context
|
35
|
+
end
|
36
|
+
def initialize0()
|
37
|
+
if @initialized
|
38
|
+
return
|
39
|
+
end
|
40
|
+
@initialized = true
|
41
|
+
@plugin::addConfigurationUpdater(FileConfigurationUpdater.new())
|
42
|
+
@plugin::addConfigurationUpdater(CustomConfigurationUpdater.new(self))
|
43
|
+
a = @plugin::getConfigurationUpdaterChain()
|
44
|
+
iter = a::iterator()
|
45
|
+
while iter::hasNext()
|
46
|
+
cu = iter::next()
|
47
|
+
initialize_(cu)
|
48
|
+
cu::updateConfiguration(@props)
|
117
49
|
end
|
118
|
-
i+=1
|
119
|
-
confVal = getProperty(value,nil)
|
120
|
-
StringTools::replace(confVal,"-","_")
|
121
|
-
StringTools::replace(confVal,"-","_")
|
122
|
-
attributes::add("\'")
|
123
|
-
attributes::add(ConfigurationKeys::imageConfigPropertiesInv::get(value))
|
124
|
-
attributes::add("\' : \'")
|
125
|
-
attributes::add(confVal)
|
126
|
-
attributes::add("\'")
|
127
|
-
end
|
128
50
|
end
|
129
|
-
|
130
|
-
|
131
|
-
appendVarJs(sb,"_wrs_conf_wirisPluginPerformance",getProperty("wirispluginperformance",nil),"Experimental settings to improve performance")
|
132
|
-
sb::add("var _wrs_conf_configuration_loaded = true;\r\n")
|
133
|
-
sb::add("if (typeof _wrs_conf_core_loaded != \'undefined\') _wrs_conf_plugin_loaded = true;\r\n")
|
134
|
-
begin
|
135
|
-
version = Storage::newResourceStorage("VERSION")::read()
|
136
|
-
end
|
137
|
-
sb::add(("var _wrs_conf_version = \'"+version)+"\';\r\n")
|
138
|
-
return sb::toString()
|
139
|
-
end
|
140
|
-
def getJsonConfiguration(configurationKeys)
|
141
|
-
configurationKeysArray = Std::split(configurationKeys,",")
|
142
|
-
iterator = configurationKeysArray::iterator()
|
143
|
-
jsonOutput = Hash.new()
|
144
|
-
jsonVariables = Hash.new()
|
145
|
-
thereIsNullValue = false
|
146
|
-
while iterator::hasNext()
|
147
|
-
key = iterator::next()
|
148
|
-
value = getProperty(key,"null")
|
149
|
-
if (value=="null")
|
150
|
-
thereIsNullValue = true
|
51
|
+
def initialize_(cu)
|
52
|
+
cu::init(@initObject)
|
151
53
|
end
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
54
|
+
def setPluginBuilderImpl(plugin)
|
55
|
+
self.plugin = plugin
|
56
|
+
end
|
57
|
+
def appendVarJs(sb, varName, value, comment)
|
58
|
+
sb::add("var ")
|
59
|
+
sb::add(varName)
|
60
|
+
sb::add(" = ")
|
61
|
+
sb::add(value)
|
62
|
+
sb::add(";")
|
63
|
+
if (comment != nil) && (comment::length() > 0)
|
64
|
+
sb::add("// ")
|
65
|
+
sb::add(comment)
|
66
|
+
end
|
67
|
+
sb::add("\r\n")
|
68
|
+
end
|
69
|
+
def appendElement2JavascriptArray(array, value)
|
70
|
+
arrayOpen = array::indexOf("[")
|
71
|
+
arrayClose = array::indexOf("]")
|
72
|
+
if (arrayOpen == -1) || (arrayClose == -1)
|
73
|
+
raise Exception,"Array not valid"
|
74
|
+
end
|
75
|
+
return ((("[" + "\'") + value) + "\'") + (array::length() == 2 ? "]" : "," + Std::substr(array,arrayOpen + 1,arrayClose - arrayOpen).to_s)
|
76
|
+
end
|
77
|
+
def getJavaScriptHash()
|
78
|
+
javaScriptHash = Hash.new()
|
79
|
+
javaScriptHash::set("editorEnabled",Boolean::valueOf((getProperty("wiriseditorenabled",nil) == "true")))
|
80
|
+
javaScriptHash::set("imageMathmlAttribute",getProperty("wiriseditormathmlattribute",nil))
|
81
|
+
javaScriptHash::set("saveMode",getProperty("wiriseditorsavemode",nil))
|
82
|
+
javaScriptHash::set("base64savemode",getProperty("wiriseditorbase64savemode",nil))
|
83
|
+
javaScriptHash::set("saveHandTraces",Boolean::valueOf((getProperty(ConfigurationKeys::SAVE_MATHML_SEMANTICS,nil) == "true")))
|
84
|
+
parseLatexElements = Array.new()
|
85
|
+
if (getProperty("wiriseditorparselatex",nil) == "true")
|
86
|
+
parseLatexElements::push("latex")
|
87
|
+
end
|
88
|
+
if (getProperty("wiriseditorparsexml",nil) == "true")
|
89
|
+
parseLatexElements::push("xml")
|
90
|
+
end
|
91
|
+
javaScriptHash::set("parseModes",parseLatexElements)
|
92
|
+
javaScriptHash::set("editorAttributes",getProperty("wiriseditorwindowattributes",nil))
|
93
|
+
javaScriptHash::set("editorUrl",@plugin::getImageServiceURL("editor",false))
|
94
|
+
javaScriptHash::set("modalWindow",Boolean::valueOf((getProperty("wiriseditormodalwindow",nil) == "true")))
|
95
|
+
javaScriptHash::set("modalWindowFullScreen",Boolean::valueOf((getProperty("wiriseditormodalwindowfullscreen",nil) == "true")))
|
96
|
+
javaScriptHash::set("CASEnabled",Boolean::valueOf((getProperty("wiriscasenabled",nil) == "true")))
|
97
|
+
javaScriptHash::set("CASMathmlAttribute",getProperty("wiriscasmathmlattribute",nil))
|
98
|
+
javaScriptHash::set("CASAttributes",getProperty("wiriscaswindowattributes",nil))
|
99
|
+
javaScriptHash::set("hostPlatform",getProperty("wirishostplatform",nil))
|
100
|
+
javaScriptHash::set("versionPlatform",getProperty("wirisversionplatform","unknown"))
|
101
|
+
javaScriptHash::set("enableAccessibility",Boolean::valueOf((getProperty("wirisaccessibilityenabled",nil) == "true")))
|
102
|
+
javaScriptHash::set("editorToolbar",getProperty(ConfigurationKeys::EDITOR_TOOLBAR,nil))
|
103
|
+
javaScriptHash::set("chemEnabled",Boolean::valueOf((getProperty("wirischemeditorenabled",nil) == "true")))
|
104
|
+
javaScriptHash::set("imageFormat",getProperty("wirisimageformat","png"))
|
105
|
+
if getProperty(ConfigurationKeys::EDITOR_PARAMS,nil) != nil
|
106
|
+
javaScriptHash::set("editorParameters",JSon::decode(getProperty(ConfigurationKeys::EDITOR_PARAMS,nil)))
|
107
|
+
else
|
108
|
+
h = ConfigurationKeys::imageConfigPropertiesInv
|
109
|
+
attributes = Hash.new()
|
110
|
+
confVal = ""
|
111
|
+
i = 0
|
112
|
+
it = h::keys()
|
113
|
+
while it::hasNext()
|
114
|
+
value = it::next()
|
115
|
+
if getProperty(value,nil) != nil
|
116
|
+
confVal = getProperty(value,nil)
|
117
|
+
StringTools::replace(confVal,"-","_")
|
118
|
+
StringTools::replace(confVal,"-","_")
|
119
|
+
attributes::set(confVal,value)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
javaScriptHash::set("editorParameters",attributes)
|
123
|
+
end
|
124
|
+
javaScriptHash::set("wirisPluginPerformance",Boolean::valueOf((getProperty("wirispluginperformance",nil) == "true")))
|
125
|
+
begin
|
126
|
+
version = Storage::newResourceStorage("VERSION")::read()
|
127
|
+
if version == nil
|
128
|
+
version = "Missing version"
|
129
|
+
end
|
130
|
+
end
|
131
|
+
javaScriptHash::set("version",version)
|
132
|
+
return javaScriptHash
|
133
|
+
end
|
134
|
+
def getJavaScriptConfigurationJson()
|
135
|
+
javaScriptHash = getJavaScriptHash()
|
136
|
+
return JSon::encode(javaScriptHash)
|
172
137
|
end
|
173
|
-
|
138
|
+
def getJsonConfiguration(configurationKeys)
|
139
|
+
configurationKeysArray = Std::split(configurationKeys,",")
|
140
|
+
iterator = configurationKeysArray::iterator()
|
141
|
+
jsonOutput = Hash.new()
|
142
|
+
jsonVariables = Hash.new()
|
143
|
+
thereIsNullValue = false
|
144
|
+
while iterator::hasNext()
|
145
|
+
key = iterator::next()
|
146
|
+
value = self.getProperty(key,"null")
|
147
|
+
if (value == "null")
|
148
|
+
thereIsNullValue = true
|
149
|
+
end
|
150
|
+
jsonVariables::set(key,value)
|
151
|
+
end
|
152
|
+
if !thereIsNullValue
|
153
|
+
jsonOutput::set("status","ok")
|
154
|
+
else
|
155
|
+
jsonOutput::set("status","warning")
|
156
|
+
end
|
157
|
+
jsonOutput::set("result",jsonVariables)
|
158
|
+
return JSon::encode(jsonOutput)
|
159
|
+
end
|
160
|
+
def setConfigurations(configurationKeys, configurationValues)
|
161
|
+
configurationKeysArray = Std::split(configurationKeys,",")
|
162
|
+
configurationValuesArray = Std::split(configurationValues,",")
|
163
|
+
keysIterator = configurationKeysArray::iterator()
|
164
|
+
valuesIterator = configurationValuesArray::iterator()
|
165
|
+
while keysIterator::hasNext() && valuesIterator::hasNext()
|
166
|
+
key = keysIterator::next()
|
167
|
+
value = valuesIterator::next()
|
168
|
+
if self.getProperty(key,nil) != nil
|
169
|
+
self.setProperty(key,value)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
174
|
end
|
175
|
-
end
|
176
175
|
end
|