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,38 +1,40 @@
|
|
|
1
1
|
module WirisPlugin
|
|
2
2
|
include Wiris
|
|
3
|
-
require('com/wiris/plugin/api/ConfigurationKeys.rb')
|
|
4
|
-
require('com/wiris/plugin/configuration/ConfigurationUpdater.rb')
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
require('com/wiris/plugin/api/ConfigurationKeys.rb')
|
|
4
|
+
require('com/wiris/plugin/configuration/ConfigurationUpdater.rb')
|
|
5
|
+
require('com/wiris/plugin/configuration/ConfigurationUpdater.rb')
|
|
6
|
+
class CustomConfigurationUpdater
|
|
7
|
+
extend ConfigurationUpdaterInterface
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
include Wiris
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
end
|
|
15
|
-
def init(obj)
|
|
16
|
-
end
|
|
17
|
-
def updateConfiguration(ref_configuration)
|
|
18
|
-
configuration = ref_configuration
|
|
19
|
-
confClass = PropertiesTools::getProperty(configuration,ConfigurationKeys::CONFIGURATION_CLASS)
|
|
20
|
-
if (confClass!=nil)&&(confClass::indexOf("com.wiris.plugin.servlets.configuration.ParameterServletConfigurationUpdater")!=-1)
|
|
21
|
-
return
|
|
22
|
-
end
|
|
23
|
-
if confClass!=nil
|
|
24
|
-
cls = Type::resolveClass(confClass)
|
|
25
|
-
if cls==nil
|
|
26
|
-
raise Exception,("Class "+confClass)+" not found."
|
|
11
|
+
attr_accessor :config
|
|
12
|
+
def initialize(config)
|
|
13
|
+
super()
|
|
14
|
+
self.config = config
|
|
27
15
|
end
|
|
28
|
-
|
|
29
|
-
if obj==nil
|
|
30
|
-
raise Exception,("Instance from "+cls.to_s)+" cannot be created."
|
|
16
|
+
def init(obj)
|
|
31
17
|
end
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
18
|
+
def updateConfiguration(ref_configuration)
|
|
19
|
+
configuration = ref_configuration
|
|
20
|
+
confClass = PropertiesTools::getProperty(configuration,ConfigurationKeys::CONFIGURATION_CLASS)
|
|
21
|
+
if (confClass != nil) && (confClass::indexOf("com.wiris.plugin.servlets.configuration.ParameterServletConfigurationUpdater") != -1)
|
|
22
|
+
return
|
|
23
|
+
end
|
|
24
|
+
if confClass != nil
|
|
25
|
+
cls = Type::resolveClass(confClass)
|
|
26
|
+
if cls == nil
|
|
27
|
+
raise Exception,("Class " + confClass) + " not found."
|
|
28
|
+
end
|
|
29
|
+
obj = Type::createInstance(cls,Array.new())
|
|
30
|
+
if obj == nil
|
|
31
|
+
raise Exception,("Instance from " + cls.to_s) + " cannot be created."
|
|
32
|
+
end
|
|
33
|
+
cu = (obj)
|
|
34
|
+
@config::initialize_(cu)
|
|
35
|
+
cu::updateConfiguration(configuration)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
36
39
|
end
|
|
37
|
-
end
|
|
38
40
|
end
|
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
module WirisPlugin
|
|
2
2
|
include Wiris
|
|
3
|
-
require('com/wiris/
|
|
4
|
-
require('com/wiris/
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
require('com/wiris/plugin/configuration/ConfigurationUpdater.rb')
|
|
4
|
+
require('com/wiris/util/sys/IniFile.rb')
|
|
5
|
+
require('com/wiris/plugin/configuration/ConfigurationUpdater.rb')
|
|
6
|
+
class DefaultConfigurationUpdater
|
|
7
|
+
extend ConfigurationUpdaterInterface
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
include Wiris
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
end
|
|
15
|
-
def updateConfiguration(ref_configuration)
|
|
16
|
-
configuration = ref_configuration
|
|
17
|
-
s = Storage::newResourceStorage("default-configuration.ini")::read()
|
|
18
|
-
defaultIniFile = IniFile::newIniFileFromString(s)
|
|
19
|
-
h = defaultIniFile::getProperties()
|
|
20
|
-
iter = h::keys()
|
|
21
|
-
while iter::hasNext()
|
|
22
|
-
key = iter::next()
|
|
23
|
-
if PropertiesTools::getProperty(configuration,key)==nil
|
|
24
|
-
PropertiesTools::setProperty(configuration,key,h::get(key))
|
|
11
|
+
def initialize()
|
|
12
|
+
super()
|
|
13
|
+
end
|
|
14
|
+
def init(obj)
|
|
25
15
|
end
|
|
26
|
-
|
|
16
|
+
def updateConfiguration(ref_configuration)
|
|
17
|
+
configuration = ref_configuration
|
|
18
|
+
s = Storage::newResourceStorage("default-configuration.ini")::read()
|
|
19
|
+
defaultIniFile = IniFile::newIniFileFromString(s)
|
|
20
|
+
h = defaultIniFile::getProperties()
|
|
21
|
+
iter = h::keys()
|
|
22
|
+
while iter::hasNext()
|
|
23
|
+
key = iter::next()
|
|
24
|
+
if PropertiesTools::getProperty(configuration,key) == nil
|
|
25
|
+
PropertiesTools::setProperty(configuration,key,h::get(key))
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
27
30
|
end
|
|
28
|
-
end
|
|
29
31
|
end
|
|
@@ -1,86 +1,88 @@
|
|
|
1
1
|
module WirisPlugin
|
|
2
2
|
include Wiris
|
|
3
|
-
require('com/wiris/plugin/api/ConfigurationKeys.rb')
|
|
4
|
-
require('com/wiris/plugin/api/Editor.rb')
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
require('com/wiris/plugin/api/ConfigurationKeys.rb')
|
|
4
|
+
require('com/wiris/plugin/api/Editor.rb')
|
|
5
|
+
require('com/wiris/plugin/api/Editor.rb')
|
|
6
|
+
class EditorImpl
|
|
7
|
+
extend EditorInterface
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
include Wiris
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
end
|
|
15
|
-
def editor(language,provider)
|
|
16
|
-
output = StringBuf.new()
|
|
17
|
-
if (language==nil)||(language::length()==0)
|
|
18
|
-
language = "en"
|
|
19
|
-
end
|
|
20
|
-
language = language::toLowerCase()
|
|
21
|
-
StringTools::replace(language,"-","_")
|
|
22
|
-
store = Storage::newResourceStorage(("lang/"+language)+"/strings.js")
|
|
23
|
-
if !store::exists()
|
|
24
|
-
store = Storage::newResourceStorage(("lang/"+Std::substr(language,0,2).to_s)+"/strings.js")
|
|
25
|
-
language = Std::substr(language,0,2)
|
|
26
|
-
if !store::exists()
|
|
27
|
-
language = "en"
|
|
11
|
+
attr_accessor :plugin
|
|
12
|
+
def initialize(plugin)
|
|
13
|
+
super()
|
|
14
|
+
self.plugin = plugin
|
|
28
15
|
end
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
16
|
+
def editor(language, provider)
|
|
17
|
+
output = StringBuf.new()
|
|
18
|
+
if (language == nil) || (language::length() == 0)
|
|
19
|
+
language = "en"
|
|
20
|
+
end
|
|
21
|
+
language = language::toLowerCase()
|
|
22
|
+
StringTools::replace(language,"-","_")
|
|
23
|
+
store = Storage::newResourceStorage(("lang/" + language) + "/strings.js")
|
|
24
|
+
if !store::exists()
|
|
25
|
+
store = Storage::newResourceStorage(("lang/" + Std::substr(language,0,2).to_s) + "/strings.js")
|
|
26
|
+
language = Std::substr(language,0,2)
|
|
27
|
+
if !store::exists()
|
|
28
|
+
language = "en"
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
attributes = StringBuf.new()
|
|
32
|
+
attributes::add("")
|
|
33
|
+
confVal = ""
|
|
34
|
+
i = 0
|
|
35
|
+
config = @plugin::getConfiguration()
|
|
36
|
+
h = ConfigurationKeys::imageConfigPropertiesInv
|
|
37
|
+
it = h::keys()
|
|
38
|
+
while it::hasNext()
|
|
39
|
+
value = it::next()
|
|
40
|
+
if config::getProperty(value,nil) != nil
|
|
41
|
+
if i != 0
|
|
42
|
+
attributes::add(",")
|
|
43
|
+
end
|
|
44
|
+
i+=1
|
|
45
|
+
confVal = config::getProperty(value,nil)
|
|
46
|
+
StringTools::replace(confVal,"-","_")
|
|
47
|
+
StringTools::replace(confVal,"-","_")
|
|
48
|
+
attributes::add("\'")
|
|
49
|
+
attributes::add(ConfigurationKeys::imageConfigPropertiesInv::get(value))
|
|
50
|
+
attributes::add("\' : \'")
|
|
51
|
+
attributes::add(confVal)
|
|
52
|
+
attributes::add("\'")
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
script = StringBuf.new()
|
|
56
|
+
if i > 0
|
|
57
|
+
script::add("<script type=\"text/javascript\">window.wrs_attributes = {")
|
|
58
|
+
script::add(attributes)
|
|
59
|
+
script::add("};</script>")
|
|
60
|
+
end
|
|
61
|
+
editorUrl = @plugin::getImageServiceURL("editor",false)
|
|
62
|
+
isSegure = (provider::getParameter("secure","false") == "true")
|
|
63
|
+
if editorUrl::startsWith("http:") && isSegure
|
|
64
|
+
editorUrl = "https:" + Std::substr(editorUrl,5).to_s
|
|
65
|
+
end
|
|
66
|
+
addLine(output,"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">")
|
|
67
|
+
addLine(output,"<html><head>")
|
|
68
|
+
addLine(output,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"/>")
|
|
69
|
+
addLine(output,script::toString())
|
|
70
|
+
addLine(output,((("<script type=\"text/javascript\" src=\"" + editorUrl) + "?lang=") + StringTools::urlEncode(language).to_s) + "\"></script>")
|
|
71
|
+
addLine(output,"<script type=\"text/javascript\" src=\"../core/editor.js\"></script>")
|
|
72
|
+
addLine(output,("<script type=\"text/javascript\" src=\"../lang/" + StringTools::urlEncode(language).to_s) + "/strings.js\"></script>")
|
|
73
|
+
addLine(output,"<title>MathType</title>")
|
|
74
|
+
addLine(output,"<style type=\"text/css\">/*<!--*/html, body, #container { height: 100%; } body { margin: 0; }")
|
|
75
|
+
addLine(output,"#links { text-align: right; margin-right: 20px; } #links_rtl {text-align: left; margin-left: 20px;} #controls { float: left; } #controls_rtl {float: right;}/*-->*/</style>")
|
|
76
|
+
addLine(output,"</head><body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">")
|
|
77
|
+
addLine(output,"<div id=\"container\"><div id=\"editorContainer\"></div><div id=\"controls\"></div>")
|
|
78
|
+
addLine(output,"<div id=\"links\"><a href=\"http://www.wiris.com/editor3/docs/manual/latex-support\" id=\"a_latex\" target=\"_blank\">LaTeX</a> | ")
|
|
79
|
+
addLine(output,"<a href=\"http://www.wiris.com/editor3/docs/manual\" target=\"_blank\" id=\"a_manual\">Manual</a></div></div></body>")
|
|
80
|
+
return output::toString()
|
|
52
81
|
end
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
script::add("};</script>")
|
|
59
|
-
end
|
|
60
|
-
editorUrl = @plugin::getImageServiceURL("editor",false)
|
|
61
|
-
isSegure = (provider::getParameter("secure","false")=="true")
|
|
62
|
-
if editorUrl::startsWith("http:")&&isSegure
|
|
63
|
-
editorUrl = "https:"+Std::substr(editorUrl,5).to_s
|
|
64
|
-
end
|
|
65
|
-
addLine(output,"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">")
|
|
66
|
-
addLine(output,"<html><head>")
|
|
67
|
-
addLine(output,"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"/>")
|
|
68
|
-
addLine(output,script::toString())
|
|
69
|
-
addLine(output,((("<script type=\"text/javascript\" src=\""+editorUrl)+"?lang=")+StringTools::urlEncode(language).to_s)+"\"></script>")
|
|
70
|
-
addLine(output,"<script type=\"text/javascript\" src=\"../core/editor.js\"></script>")
|
|
71
|
-
addLine(output,("<script type=\"text/javascript\" src=\"../lang/"+StringTools::urlEncode(language).to_s)+"/strings.js\"></script>")
|
|
72
|
-
addLine(output,"<title>WIRIS editor</title>")
|
|
73
|
-
addLine(output,"<style type=\"text/css\">/*<!--*/html, body, #container { height: 100%; } body { margin: 0; }")
|
|
74
|
-
addLine(output,"#links { text-align: right; margin-right: 20px; } #links_rtl {text-align: left; margin-left: 20px;} #controls { float: left; } #controls_rtl {float: right;}/*-->*/</style>")
|
|
75
|
-
addLine(output,"</head><body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">")
|
|
76
|
-
addLine(output,"<div id=\"container\"><div id=\"editorContainer\"></div><div id=\"controls\"></div>")
|
|
77
|
-
addLine(output,"<div id=\"links\"><a href=\"http://www.wiris.com/editor3/docs/manual/latex-support\" id=\"a_latex\" target=\"_blank\">LaTeX</a> | ")
|
|
78
|
-
addLine(output,"<a href=\"http://www.wiris.com/editor3/docs/manual\" target=\"_blank\" id=\"a_manual\">Manual</a></div></div></body>")
|
|
79
|
-
return output::toString()
|
|
80
|
-
end
|
|
81
|
-
def addLine(output,s)
|
|
82
|
-
output::add(s)
|
|
83
|
-
output::add("\r\n")
|
|
82
|
+
def addLine(output, s)
|
|
83
|
+
output::add(s)
|
|
84
|
+
output::add("\r\n")
|
|
85
|
+
end
|
|
86
|
+
|
|
84
87
|
end
|
|
85
|
-
end
|
|
86
88
|
end
|
|
@@ -1,34 +1,36 @@
|
|
|
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/configuration/ConfigurationUpdater.rb')
|
|
5
|
+
require('com/wiris/util/sys/IniFile.rb')
|
|
6
|
+
require('com/wiris/plugin/configuration/ConfigurationUpdater.rb')
|
|
7
|
+
class FileConfigurationUpdater
|
|
8
|
+
extend ConfigurationUpdaterInterface
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
include Wiris
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
end
|
|
16
|
-
def updateConfiguration(ref_configuration)
|
|
17
|
-
configuration = ref_configuration
|
|
18
|
-
confDir = PropertiesTools::getProperty(configuration,ConfigurationKeys::CONFIGURATION_PATH)
|
|
19
|
-
if confDir!=nil
|
|
20
|
-
confFile = confDir+"/configuration.ini"
|
|
21
|
-
s = Storage::newStorage(confFile)
|
|
22
|
-
if s::exists()
|
|
23
|
-
defaultIniFile = IniFile::newIniFileFromFilename(confFile)
|
|
24
|
-
h = defaultIniFile::getProperties()
|
|
25
|
-
iter = h::keys()
|
|
26
|
-
while iter::hasNext()
|
|
27
|
-
key = iter::next()
|
|
28
|
-
PropertiesTools::setProperty(configuration,key,h::get(key))
|
|
29
|
-
end
|
|
12
|
+
def initialize()
|
|
13
|
+
super()
|
|
14
|
+
end
|
|
15
|
+
def init(obj)
|
|
30
16
|
end
|
|
31
|
-
|
|
17
|
+
def updateConfiguration(ref_configuration)
|
|
18
|
+
configuration = ref_configuration
|
|
19
|
+
confDir = PropertiesTools::getProperty(configuration,ConfigurationKeys::CONFIGURATION_PATH)
|
|
20
|
+
if confDir != nil
|
|
21
|
+
confFile = confDir + "/configuration.ini"
|
|
22
|
+
s = Storage::newStorage(confFile)
|
|
23
|
+
if s::exists()
|
|
24
|
+
defaultIniFile = IniFile::newIniFileFromFilename(confFile)
|
|
25
|
+
h = defaultIniFile::getProperties()
|
|
26
|
+
iter = h::keys()
|
|
27
|
+
while iter::hasNext()
|
|
28
|
+
key = iter::next()
|
|
29
|
+
PropertiesTools::setProperty(configuration,key,h::get(key))
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
32
35
|
end
|
|
33
|
-
end
|
|
34
36
|
end
|
|
@@ -1,59 +1,61 @@
|
|
|
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/storage/StorageAndCache.rb')
|
|
5
|
+
require('com/wiris/util/sys/Store.rb')
|
|
6
|
+
require('com/wiris/plugin/storage/StorageAndCache.rb')
|
|
7
|
+
class FileStorageAndCache
|
|
8
|
+
extend StorageAndCacheInterface
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
include Wiris
|
|
11
|
+
|
|
12
|
+
attr_accessor :config
|
|
13
|
+
def initialize()
|
|
14
|
+
super()
|
|
15
|
+
end
|
|
16
|
+
def init(obj, config, cache, cacheFormula)
|
|
17
|
+
self.config = config
|
|
18
|
+
end
|
|
19
|
+
def codeDigest(content)
|
|
20
|
+
formula = getAndCheckFolder(ConfigurationKeys::FORMULA_FOLDER)
|
|
21
|
+
digest = Md5Tools::encodeString(content)
|
|
22
|
+
store = Store::newStoreWithParent(Store::newStore(formula),digest + ".ini")
|
|
23
|
+
store::write(content)
|
|
24
|
+
return digest
|
|
25
|
+
end
|
|
26
|
+
def decodeDigest(digest)
|
|
27
|
+
formula = getAndCheckFolder(ConfigurationKeys::FORMULA_FOLDER)
|
|
28
|
+
store = Store::newStoreWithParent(Store::newStore(formula),digest + ".ini")
|
|
29
|
+
return store::read()
|
|
30
|
+
end
|
|
31
|
+
def retreiveData(digest, service)
|
|
32
|
+
formula = getAndCheckFolder(ConfigurationKeys::CACHE_FOLDER)
|
|
33
|
+
store = Store::newStoreWithParent(Store::newStore(formula),digest + getExtension(service))
|
|
34
|
+
if !store::exists()
|
|
35
|
+
return nil
|
|
36
|
+
end
|
|
37
|
+
return store::readBinary()::getData()
|
|
38
|
+
end
|
|
39
|
+
def storeData(digest, service, stream)
|
|
40
|
+
formula = getAndCheckFolder(ConfigurationKeys::CACHE_FOLDER)
|
|
41
|
+
store = Store::newStoreWithParent(Store::newStore(formula),digest + getExtension(service))
|
|
42
|
+
store::writeBinary(Bytes::ofData(stream))
|
|
43
|
+
end
|
|
44
|
+
def getAndCheckFolder(key)
|
|
45
|
+
folder = PropertiesTools::getProperty(@config,key)
|
|
46
|
+
if (folder == nil) || (folder::trim()::length() == 0)
|
|
47
|
+
raise Exception,"Missing configuration value: " + key
|
|
48
|
+
end
|
|
49
|
+
return folder
|
|
50
|
+
end
|
|
51
|
+
def getExtension(service)
|
|
52
|
+
if (service == "png")
|
|
53
|
+
return ".png"
|
|
54
|
+
end
|
|
55
|
+
return ("." + service) + ".txt"
|
|
56
|
+
end
|
|
57
|
+
def deleteCache()
|
|
58
|
+
end
|
|
10
59
|
|
|
11
|
-
attr_accessor :config
|
|
12
|
-
def initialize()
|
|
13
|
-
super()
|
|
14
|
-
end
|
|
15
|
-
def init(obj,config)
|
|
16
|
-
@config = config
|
|
17
|
-
end
|
|
18
|
-
def codeDigest(content)
|
|
19
|
-
formula = getAndCheckFolder(ConfigurationKeys::FORMULA_FOLDER)
|
|
20
|
-
digest = Md5Tools::encodeString(content)
|
|
21
|
-
store = Store::newStoreWithParent(Store::newStore(formula),digest+".ini")
|
|
22
|
-
store::write(content)
|
|
23
|
-
return digest
|
|
24
|
-
end
|
|
25
|
-
def decodeDigest(digest)
|
|
26
|
-
formula = getAndCheckFolder(ConfigurationKeys::FORMULA_FOLDER)
|
|
27
|
-
store = Store::newStoreWithParent(Store::newStore(formula),digest+".ini")
|
|
28
|
-
return store::read()
|
|
29
|
-
end
|
|
30
|
-
def retreiveData(digest,service)
|
|
31
|
-
formula = getAndCheckFolder(ConfigurationKeys::CACHE_FOLDER)
|
|
32
|
-
store = Store::newStoreWithParent(Store::newStore(formula),digest+getExtension(service))
|
|
33
|
-
if !store::exists()
|
|
34
|
-
return nil
|
|
35
|
-
end
|
|
36
|
-
return store::readBinary()::getData()
|
|
37
|
-
end
|
|
38
|
-
def storeData(digest,service,stream)
|
|
39
|
-
formula = getAndCheckFolder(ConfigurationKeys::CACHE_FOLDER)
|
|
40
|
-
store = Store::newStoreWithParent(Store::newStore(formula),digest+getExtension(service))
|
|
41
|
-
store::writeBinary(Bytes::ofData(stream))
|
|
42
|
-
end
|
|
43
|
-
def getAndCheckFolder(key)
|
|
44
|
-
folder = PropertiesTools::getProperty(@config,key)
|
|
45
|
-
if (folder==nil)||(folder::trim()::length()==0)
|
|
46
|
-
raise Exception,"Missing configuration value: "+key
|
|
47
|
-
end
|
|
48
|
-
return folder
|
|
49
|
-
end
|
|
50
|
-
def getExtension(service)
|
|
51
|
-
if (service=="png")
|
|
52
|
-
return ".png"
|
|
53
|
-
end
|
|
54
|
-
return ("."+service)+".txt"
|
|
55
|
-
end
|
|
56
|
-
def deleteCache()
|
|
57
60
|
end
|
|
58
|
-
end
|
|
59
61
|
end
|