Feature #2204 delete fckeditor wiris because this plugin is incompatible with GNU-GPL license. The plugin will work after downloaded from the Web WIRIS

skala
Juan Carlos Raña 15 years ago
parent d1c24befbd
commit 42416eda9e
  1. 6
      documentation/installation_guide.html
  2. 5
      documentation/installation_guide_es_ES.html
  3. 1
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/VERSION
  4. 1
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/cache/info.txt
  5. 45
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/configuration.ini
  6. 76
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/configuration.ini.default
  7. BIN
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/core/cas.gif
  8. 231
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/core/cas.js
  9. 889
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/core/core.js
  10. 94
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/core/editor.js
  11. BIN
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/core/wiris-cas.gif
  12. BIN
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/core/wiris-formula.gif
  13. 336
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/fckplugin.js
  14. 1
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/formulas/info.txt
  15. 94
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/integration/cas.php
  16. 32
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/integration/createcasimage.php
  17. 56
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/integration/createimage.php
  18. 72
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/integration/editor.php
  19. 34
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/integration/getmathml.php
  20. 93
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/integration/libwiris.php
  21. 20
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/integration/showcasimage.php
  22. 100
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/integration/showimage.php
  23. 3
      main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/readme.txt
  24. 2
      main/lang/english/admin.inc.php
  25. 2
      main/lang/spanish/admin.inc.php

@ -45,6 +45,7 @@
<li><a href="#6._LDAP">LDAP&nbsp;</a></li>
<li><a href="#7._Mathematical_formulas">Mathematical formulas with LaTeX</a></li>
<li><a href="#8._ASCIIMathML_mathematical_formulas">Mathematical formulas with ASCIIMathML</a></li>
<li><a href="#9._WIRIS_mathematical_formulas">Mathematical formulas with WIRIS</a></li>
</ol>
<br />
@ -686,6 +687,11 @@ You may need to alter the setting to be for example:</p>
<li>... or something else</li>
</ul>
<p>For testing how the variable <strong>AMTcgiloc</strong> may be set, there are some examples (as comments) inside the script.</p>
<hr style="width: 100%; height: 2px;" />
<h2><a name="9._WIRIS_mathematical_formulas"></a>9. Mathematical formulas with WIRIS</h2>
<p>Installing this plugin you get WIRIS editor and WIRIS CAS. <br/>
This activation is not fully realized unless it has been previously downloaded the <a href="http://www.wiris.com/plugins/editors/download?filter=fckeditor" target="_blank">PHP plugin for FCKeditor WIRIS</a> and unzipped its contents in the Chamilo's directory main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/ <br/>This is necessary because Wiris is proprietary software and his services are <a href="http://www.wiris.com/store/who-pays" target="_blank">commercial</a>. To make adjustments to the plugin, edit configuration.ini file or replace his content by configuration.ini.default Chamilo file.</p>
<hr style="width: 100%; height: 2px;" />
<p>
<br />

@ -53,6 +53,7 @@ no son requeridos para usar Chamilo LMS. &nbsp;Por favor, lea completamente este
<li><a href="#6._LDAP">LDAP&nbsp;</a></li>
<li><a href="#7._Mathematical_formulas">Fórmulas Matemáticas con LaTeX</a></li>
<li><a href="#8._ASCIIMathML_mathematical_formulas">Fórmulas Matemáticas con ASCIIMathML</a></li>
<li><a href="#9._WIRIS_mathematical_formulas">Fórmulas Matemáticas con WIRIS</a></li>
</ol>
@ -780,6 +781,10 @@ Podría necesitar modificar el ejemplo para tener algo como:</p>
</ul>
<p>Para formas de probar como la variable <strong>AMTcgiloc</strong> tiene que ser configurada, existen unos ejemplos (en comentario) dentro del script.</p>
<hr style="width: 100%; height: 2px;" />
<h2><a name="9._WIRIS_mathematical_formulas"></a>9. Fórmulas matemáticas con WIRIS</h2>
<p>Instalando este plugin obtendrá WIRIS editor y WIRIS CAS. <br/>La activación no se realiza completamente si previamente no ha descargado el <a href="http://www.wiris.com/plugins/editors/download?filter=fckeditor" target="_blank">PHP plugin for FCKeditor de WIRIS</a> y descomprimido su contenido en el directorio de Chamilo main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/ <br/>Esto es necesario debido a que Wiris es un software propietario y los servicios de Wiris son <a href="http://www.wiris.com/store/who-pays" target="_blank">comerciales</a>. Para realizar ajustes en el plugin edite el archivo configuration.ini o sustituya su contenido por el de configuration.ini.default que acompaña a Chamilo.
</p>
<hr style="width: 100%; height: 2px;" />
<p>
<br />
<br />

@ -1 +0,0 @@
This directory is used to save images

@ -1,45 +0,0 @@
wirisimageservicehost = services.wiris.net
wirisimageserviceport = 80
wirisimageservicepath = /demo/formula/render
wirisimageserviceversion = 2.0
wiristransparency = true
;wirisimagebgcolor = #ffffff
;wirisimagefontsize = 16
;wirisimageidentcolor = #000000
;wirisimagenumbercolor = #000000
;wirisimagesymbolcolor = #000000
;wirisimageidentmathvariant = italic-sans-serif
;wirisimagenumbermathvariant = sans-serif
;wirisimagefontident = Courier
;wirisimagefontnumber = Dialog
;wirisimagefontranges = font1, font2
;font1 = x3b1-x3ff;DialogInput,105
;font2 = x41-x5A;FreeSans
wirisformulaeditorcodebase = http://services.wiris.net/demo/formula/codebase/
wirisformulaeditorarchive = wiriseditor.jar
wirisformulaeditorcode = WirisFormulaEditor
wirisformulaeditorlang = en
wiriscascodebase = http://www.wiris.net/demo/wiris/wiris-codebase
wiriscasarchive = wrs_net_%LANG.jar
wiriscasclass = WirisApplet_net_%LANG
wiriscaslanguages = en, es, fr, it, nl, et, ca, eu, pt, de
CAS_width = 450
CAS_height = 400
; Only for PHP integration.
wirisproxy = false
wirisproxy_host =
wirisproxy_port =
; Only for java integration.
;wirisstorageclass = com.wiris.plugin.storage.FileStorageAndCache
;wiriscontainerstorageclass = com.wiris.plugin.storage.FileStorageAndCache
; Place to store the cached images.
;wiriscachedirectory = /var/cache
; Place to store the formulas.
;wirisformuladirectory = /var/formulas

@ -0,0 +1,76 @@
wirisimageservicehost = services.wiris.net
//wirisimageservicehost = localhost
wirisimageserviceport = 80
wirisimageservicepath = /demo/formula/render
//wirisimageservicepath = /chamilo/main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/cache
wirisimageserviceversion = 2.0
wiristransparency = true
#wirisimagebgcolor = #ffffff
#wirisimagefontsize = 16
#wirisimageidentcolor = #000000
#wirisimagenumbercolor = #000000
#wirisimagesymbolcolor = #000000
#wirisimageidentmathvariant = italic-sans-serif
#wirisimagenumbermathvariant = sans-serif
#wirisimagefontident = Courier
#wirisimagefontnumber = Dialog
#wirisimagefontranges = font1, font2
#font1 = x3b1-x3ff;DialogInput,105
#font2 = x41-x5A;FreeSans
wirisformulaeditorcodebase = http://services.wiris.net/demo/formula/codebase/
//wirisformulaeditorcodebase = http://localhost/chamilo/main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/
wirisformulaeditorarchive = wiriseditor.jar
wirisformulaeditorcode = WirisFormulaEditor
wirisformulaeditorlang = en
//////
wiriscascodebase = http://www.wiris.net/demo/wiris/wiris-codebase
//wiriscascodebase = http://www.juntadeandalucia.es/averroes/wiris/wiris-codebase
//wiriscascodebase = http://herramientas.educa.madrid.org/wiris/wiris-codebase
//wiriscascodebase = http://nea.educastur.princast.es/wiris/wiris-codebase
//wiriscascodebase = http://www.educa.jcyl.es/wiris/wiris-codebase
//wiriscascodebase = http://calculadora.edu365.cat/wiris/wiris-codebase
//wiriscascodebase = http://www.wiris.ee/wiris/wiris-codebase
//wiriscascodebase = http://users.wirisonline.net/applet
//wiriscascodebase = http://wiris.schule.at/wiris-codebase
wiriscasarchive = wrs_net_%LANG.jar
//wiriscasarchive = wrs_andalucia_es.jar
//wiriscasarchive = wrs_cam_es.jar
//wiriscasarchive = wrs_asturias_es.jar
//wiriscasarchive = wrs_castleon_es.jar
//wiriscasarchive = wrs_edu365_ca.jar
//wiriscasarchive = wrs_estonia_et.jar
//wiriscasarchive = wrs_wnl_nl.jar
//wiriscasarchive = wrs_austria_de_en.jar
wiriscasclass = WirisApplet_net_%LANG
//wiriscasclass = WirisApplet_andalucia_es
//wiriscasclass = WirisApplet_cam_es
//wiriscasclass = WirisApplet_asturias_es
//wiriscasclass = WirisApplet_castleon_es
//wiriscasclass = WirisApplet_edu365_ca
//wiriscasclass = WirisApplet_estonia_et
//wiriscasclass = WirisApplet_wnl_nl
//wiriscasclass = WirisApplet_austria_de_en
wiriscaslanguages = en, es, fr, it, nl, et, ca, eu, pt, de
CAS_width = 450
CAS_height = 400
wirisproxy = false
wirisproxy_host =
wirisproxy_port =
//////
// Place to store the cached images.
//wiriscachedirectory = /var/cache
// Place to store the formulas.
//wirisformuladirectory = /var/formulas

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

@ -1,231 +0,0 @@
var wrs_opener;
var appletObject;
var initialXML = '';
var closeFunction;
if (window.opener) { // For popup mode.
wrs_opener = window.opener;
closeFunction = window.close;
}
// FCKeditor integration begin
else { // For iframe mode.
wrs_opener = window.parent;
while (wrs_opener.InnerDialogLoaded) {
wrs_opener = wrs_opener.parent;
}
}
if (window.parent.InnerDialogLoaded) { // Iframe mode.
window.parent.InnerDialogLoaded();
closeFunction = window.parent.Cancel;
}
else if (window.opener.parent.FCKeditorAPI) { // Popup mode.
wrs_opener = window.opener.parent;
}
// FCKeditor integration end
function getMathmlFromAppletCode(appletCode) {
var optionForm = document.getElementById('optionForm');
appletObject = wrs_opener.wrs_createObject(appletCode, document);
optionForm.width.value = parseInt(appletObject.width);
optionForm.height.value = parseInt(appletObject.height);
var params = appletObject.childNodes;
var mathml = '';
for (var i = 0; i < params.length; ++i) {
if (params[i].name == 'xmlinitialtext') {
mathml = params[i].value;
}
else if (params[i].name == 'requestfirstevaluation') {
optionForm.executeonload.checked = (params[i].value == 'true') ? true : false;
}
else if (params[i].name == 'toolbar') {
optionForm.toolbar.checked = (params[i].value == 'floating') ? false : true;
}
else if (params[i].name == 'requestfocus') {
optionForm.focusonload.checked = (params[i].value == 'true') ? true : false;
}
else if (params[i].name == 'level') {
optionForm.level.checked = (params[i].value == 'primary') ? true : false;
}
}
return mathml;
}
function createIframePath(params) {
var iframePath = wrs_opener._wrs_conf_CASPath;
iframePath += ((iframePath.indexOf('?') == -1) ? '?' : '&') + 'mode=applet&';
for (var i in params) {
iframePath += wrs_opener.wrs_urlencode(i) + '=' + wrs_opener.wrs_urlencode(params[i]);
}
return iframePath;
}
function createIframe(params) {
var iframe = document.createElement('iframe');
iframe.id = 'appletContainerIframe';
iframe.src = createIframePath(params);
iframe.width = '100%';
iframe.height = '100%';
iframe.frameBorder = 0;
wrs_opener.wrs_addEvent(iframe, 'load', function () {
if (initialXML.length > 0) {
var applet = iframe.contentWindow.document.getElementById('applet');
function setAppletMathml() {
// Internet explorer fails on "applet.isActive". It only supports "applet.isActive()".
try {
if (applet.isActive && applet.isActive()) {
applet.setXML(initialXML);
}
else {
setTimeout(setAppletMathml, 50);
}
}
catch (e) {
if (applet.isActive()) {
applet.setXML(initialXML);
}
else {
setTimeout(setAppletMathml, 50);
}
}
}
setAppletMathml();
}
});
document.getElementById('appletContainer').appendChild(iframe);
}
function reloadIframe(params) {
var iframe = document.getElementById('appletContainerIframe');
var applet = iframe.contentWindow.document.getElementById('applet');
initialXML = applet.getXML();
iframe.src = createIframePath(params);
}
wrs_opener.wrs_addEvent(window, 'load', function () {
// Getting language list <select> object.
var languageList = document.getElementById('languageList');
// When the language list <select> object changes its value, the iframe should be refreshed.
wrs_opener.wrs_addEvent(languageList, 'change', function () {
reloadIframe({
'lang': languageList.value
});
});
// Setting iframe language.
var language;
if (wrs_opener._wrs_isNewElement) {
language = wrs_opener._wrs_int_language;
}
else {
var appletCode = wrs_opener._wrs_temporalImage.getAttribute(wrs_opener._wrs_conf_CASMathmlAttribute);
initialXML = getMathmlFromAppletCode(wrs_opener.wrs_mathmlDecode(appletCode));
var language = '';
// We can convert initialXML to an object and get its "lang" value. However, IE does not support this functionability, so we use string parsing.
var languageStart = initialXML.indexOf('lang="');
if (languageStart != -1) {
var languageEnd = initialXML.indexOf('"', languageStart + 6); // +6 because 'lang="'.length is 6.
if (languageEnd != -1) {
language = initialXML.substring(languageStart + 6, languageEnd);
}
}
}
// Creating the iframe.
createIframe({
'lang': language
});
// Selecting the language on the <select> object.
for (var i = languageList.options.length - 1; i >= 0; --i) {
if (languageList.options[i].value == language) {
languageList.selectedIndex = i;
i = 0;
}
}
// More events.
wrs_opener.wrs_addEvent(document.getElementById('submit'), 'click', function () {
var applet = document.getElementById('appletContainerIframe').contentWindow.document.getElementById('applet');
// Creating new applet code
var optionForm = document.getElementById('optionForm');
var newWidth = parseInt(optionForm.width.value);
var newHeight = parseInt(optionForm.height.value);
var appletCode = '<applet alt="WIRIS CAS" class="Wiriscas" align="middle" ';
appletCode += 'codebase="' + applet.getAttribute('codebase') + '" ';
appletCode += 'archive="' + applet.getAttribute('archive') + '" ';
appletCode += 'code="' + applet.getAttribute('code') + '" ';
appletCode += 'width="' + newWidth + '" height="' + newHeight + '">';
appletCode += '<param name="requestfirstevaluation" value="' + (optionForm.executeonload.checked ? 'true' : 'false') + '"></param>';
appletCode += '<param name="toolbar" value="' + (optionForm.toolbar.checked ? 'true' : 'floating') + '"></param>';
appletCode += '<param name="requestfocus" value="' + (optionForm.focusonload.checked ? 'true' : 'false') + '"></param>';
appletCode += '<param name="level" value="' + (optionForm.level.checked ? 'primary' : 'false') + '"></param>';
appletCode += '<param name="xmlinitialtext" value="' + wrs_opener.wrs_htmlentities(applet.getXML()) + '"></param>';
appletCode += '<param name="interface" value="false"></param><param name="commands" value="false"></param><param name="command" value="false"></param>';
appletCode += '</applet>';
// Getting the image
// First, resize applet
applet.width = newWidth;
applet.height = newHeight;
// Waiting for applet resizing
function finish() {
if (applet.getSize().width != applet.width || applet.getSize().height != applet.height) {
setTimeout(finish, 100);
}
else {
// Getting the image
var image = applet.getImageBase64('png');
// FCKeditor integration begin
if (window.parent.InnerDialogLoaded && window.parent.FCKBrowserInfo.IsIE) { // On IE, we must close the dialog for push the caret on the correct position.
closeFunction();
wrs_opener.wrs_int_updateCAS(appletCode, image, newWidth, newHeight);
}
// FCKeditor integration end
else {
wrs_opener.wrs_int_updateCAS(appletCode, image, newWidth, newHeight);
closeFunction();
}
}
}
finish();
});
wrs_opener.wrs_addEvent(document.getElementById('cancel'), 'click', function () {
closeFunction();
});
});
wrs_opener.wrs_addEvent(window, 'unload', function () {
wrs_opener.wrs_int_notifyWindowClosed();
});

@ -1,889 +0,0 @@
// Vars
var _wrs_currentPath = window.location.toString().substr(0, window.location.toString().lastIndexOf('/') + 1);
var _wrs_isNewElement = true;
var _wrs_temporalImage;
var _wrs_xmlCharacters = {
'tagOpener': '<', // \x3C
'tagCloser': '>', // \x3E
'doubleQuote': '"', // \x22
'ampersand': '&', // \x26
'quote': '\'' // \x27
};
var _wrs_safeXmlCharacters = {
'tagOpener': '«', // \xAB
'tagCloser': '»', // \xBB
'doubleQuote': '¨', // \xA8
'ampersand': '§', // \xA7
'quote': '`' // \xB4
};
var _wrs_safeXmlCharactersEntities = {
'tagOpener': '&laquo;',
'tagCloser': '&raquo;',
'doubleQuote': '&uml;'
}
/**
* Cross-browser addEventListener/attachEvent function.
* @param object element Element target
* @param event event Event
* @param function func Function to run
*/
function wrs_addEvent(element, event, func) {
if (element.addEventListener) {
element.addEventListener(event, func, false);
}
else if (element.attachEvent) {
element.attachEvent('on' + event, func);
}
}
/**
* Adds iframe events.
* @param object iframe Target
* @param function doubleClickHandler Function to run when user double clicks the iframe
* @param function mousedownHandler Function to run when user mousedowns the iframe
* @param function mouseupHandler Function to run when user mouseups the iframe
*/
function wrs_addIframeEvents(iframe, doubleClickHandler, mousedownHandler, mouseupHandler) {
if (doubleClickHandler) {
wrs_addEvent(iframe.contentWindow.document, 'dblclick', function (event) {
var realEvent = (event) ? event : window.event;
var element = realEvent.srcElement ? realEvent.srcElement : realEvent.target;
doubleClickHandler(iframe, element, realEvent);
});
}
if (mousedownHandler) {
wrs_addEvent(iframe.contentWindow.document, 'mousedown', function (event) {
var realEvent = (event) ? event : window.event;
var element = realEvent.srcElement ? realEvent.srcElement : realEvent.target;
mousedownHandler(iframe, element, realEvent);
});
}
if (mouseupHandler) {
wrs_addEvent(iframe.contentWindow.document, 'mouseup', function (event) {
var realEvent = (event) ? event : window.event;
var element = realEvent.srcElement ? realEvent.srcElement : realEvent.target;
mouseupHandler(iframe, element, realEvent);
});
}
}
/**
* Adds textarea events.
* @param object textarea Target
* @param function clickHandler Function to run when user clicks the textarea.
*/
function wrs_addTextareaEvents(textarea, clickHandler) {
if (clickHandler) {
wrs_addEvent(textarea, 'click', function (event) {
var realEvent = (event) ? event : window.event;
clickHandler(textarea, realEvent);
});
}
}
/**
* Converts applet code to img object.
* @param object creator Object with "createElement" method
* @param string appletCode Applet code
* @param string image Base 64 image stream
* @param int imageWidth Image width
* @param int imageHeight Image height
* @return object
*/
function wrs_appletCodeToImgObject(creator, appletCode, image, imageWidth, imageHeight) {
var imageSrc = wrs_createImageCASSrc(image);
var imgObject = creator.createElement('img');
imgObject.title = 'Double click to edit';
imgObject.src = imageSrc;
imgObject.align = 'middle';
imgObject.width = imageWidth;
imgObject.height = imageHeight;
imgObject.setAttribute(_wrs_conf_CASMathmlAttribute, wrs_mathmlEncode(appletCode));
imgObject.className = 'Wiriscas';
return imgObject;
}
/**
* Checks if an element contains a class.
* @param object element
* @param string className
* @return bool
*/
function wrs_containsClass(element, className) {
var currentClasses = element.className.split(' ');
for (var i = currentClasses.length - 1; i >= 0; --i) {
if (currentClasses[i] == className) {
return true;
}
}
return false;
}
/**
* Cross-browser solution for creating new elements.
*
* It fixes some browser bugs.
*
* @param string elementName The tag name of the wished element.
* @param object attributes An object where each key is a wished attribute name and each value is its value.
* @param object creator Optional param. If supplied, this function will use the "createElement" method from this param. Else, "document" will be used.
* @return object The DOM element with the specified attributes assignated.
*/
function wrs_createElement(elementName, attributes, creator) {
if (attributes === undefined) {
attributes = {};
}
if (creator === undefined) {
creator = document;
}
var element;
/*
* Internet Explorer fix:
* If you create a new object dynamically, you can't set a non-standard attribute.
* For example, you can't set the "src" attribute on an "applet" object.
* Other browsers will throw an exception and will run the standard code.
*/
try {
var html = '<' + elementName + ' ';
for (var attributeName in attributes) {
html += attributeName + '="' + wrs_htmlentities(attributes[attributeName]) + '" ';
}
html += '>';
element = creator.createElement(html);
}
catch (e) {
element = creator.createElement(elementName);
for (var attributeName in attributes) {
element.setAttribute(attributeName, attributes[attributeName]);
}
}
return element;
}
/**
* Cross-browser httpRequest creation.
* @return object
*/
function wrs_createHttpRequest() {
if (typeof XMLHttpRequest != 'undefined') {
return new XMLHttpRequest();
}
try {
return new ActiveXObject('Msxml2.XMLHTTP');
}
catch (e) {
try {
return new ActiveXObject('Microsoft.XMLHTTP');
}
catch (oc) {
}
}
return false;
}
/**
* Gets CAS image src with AJAX.
* @param string image Base 64 image stream
* @return string
*/
function wrs_createImageCASSrc(image, appletCode) {
var httpRequest = wrs_createHttpRequest();
if (httpRequest) {
var data = 'image=' + wrs_urlencode(image);
if (appletCode) {
data += '&mml=' + wrs_urlencode(appletCode);
}
if (_wrs_conf_createcasimagePath.substr(0, 1) == '/' || _wrs_conf_createcasimagePath.substr(0, 7) == 'http://' || _wrs_conf_createimagePath.substr(0, 8) == 'https://') {
httpRequest.open('POST', _wrs_conf_createcasimagePath, false);
}
else {
httpRequest.open('POST', _wrs_currentPath + _wrs_conf_createcasimagePath, false);
}
httpRequest.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=UTF-8');
httpRequest.send(data);
return httpRequest.responseText;
}
alert('Your browser is not compatible with AJAX technology. Please, use the latest version of Mozilla Firefox.');
return '';
}
/**
* Gets formula image src with AJAX.
* @param mathml Mathml code
* @param wirisProperties
* @return string Image src
*/
function wrs_createImageSrc(mathml, wirisProperties) {
var httpRequest = wrs_createHttpRequest();
if (httpRequest) {
var data = (wirisProperties) ? wirisProperties : {};
data['mml'] = mathml;
if (window._wrs_conf_useDigestInsteadOfMathml && _wrs_conf_useDigestInsteadOfMathml) {
data['returnDigest'] = 'true';
}
if (_wrs_conf_createimagePath.substr(0, 1) == '/' || _wrs_conf_createimagePath.substr(0, 7) == 'http://' || _wrs_conf_createimagePath.substr(0, 8) == 'https://') {
httpRequest.open('POST', _wrs_conf_createimagePath, false);
}
else {
httpRequest.open('POST', _wrs_currentPath + _wrs_conf_createimagePath, false);
}
httpRequest.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=UTF-8');
httpRequest.send(wrs_httpBuildQuery(data));
return httpRequest.responseText;
}
alert('Your browser is not compatible with AJAX technology. Please, use the latest version of Mozilla Firefox.');
return '';
}
/**
* Creates new object using its html code.
* @param string objectCode
* @return object
*/
function wrs_createObject(objectCode, creator) {
if (creator === undefined) {
creator = document;
}
// Internet Explorer can't include "param" tag when is setting an innerHTML property.
objectCode = objectCode.split('<applet ').join('<span wirisObject="WirisApplet" ').split('<APPLET ').join('<span wirisObject="WirisApplet" '); // It is a 'span' because 'span' objects can contain 'br' nodes.
objectCode = objectCode.split('</applet>').join('</span>').split('</APPLET>').join('</span>');
objectCode = objectCode.split('<param ').join('<br wirisObject="WirisParam" ').split('<PARAM ').join('<br wirisObject="WirisParam" '); // It is a 'br' because 'br' can't contain nodes.
objectCode = objectCode.split('</param>').join('</br>').split('</PARAM>').join('</br>');
var container = wrs_createElement('div', {}, creator);
container.innerHTML = objectCode;
function recursiveParamsFix(object) {
if (object.getAttribute && object.getAttribute('wirisObject') == 'WirisParam') {
var attributesParsed = {};
for (var i = 0; i < object.attributes.length; ++i) {
if (object.attributes[i].nodeValue !== null) {
attributesParsed[object.attributes[i].nodeName] = object.attributes[i].nodeValue;
}
}
var param = wrs_createElement('param', attributesParsed, creator);
// IE fix
if (param.NAME) {
param.name = param.NAME;
param.value = param.VALUE;
}
param.removeAttribute('wirisObject');
object.parentNode.replaceChild(param, object);
}
else if (object.getAttribute && object.getAttribute('wirisObject') == 'WirisApplet') {
var attributesParsed = {};
for (var i = 0; i < object.attributes.length; ++i) {
if (object.attributes[i].nodeValue !== null) {
attributesParsed[object.attributes[i].nodeName] = object.attributes[i].nodeValue;
}
}
var applet = wrs_createElement('applet', attributesParsed, creator);
applet.removeAttribute('wirisObject');
for (var i = 0; i < object.childNodes.length; ++i) {
recursiveParamsFix(object.childNodes[i]);
if (object.childNodes[i].nodeName.toLowerCase() == 'param') {
applet.appendChild(object.childNodes[i]);
--i; // When we insert the object child into the applet, object loses one child.
}
}
object.parentNode.replaceChild(applet, object);
}
else {
for (var i = 0; i < object.childNodes.length; ++i) {
recursiveParamsFix(object.childNodes[i]);
}
}
}
recursiveParamsFix(container);
return container.firstChild;
}
/**
* Converts an object to its HTML code.
* @param object object
* @return string
*/
function wrs_createObjectCode(object, creator) {
if (creator === undefined) {
creator = document;
}
var parent = object.parentNode;
var toReturn;
if (parent != null) {
var newParent = wrs_createElement(parent.tagName, {}, creator);
parent.replaceChild(newParent, object);
newParent.appendChild(object);
toReturn = newParent.innerHTML;
parent.replaceChild(object, newParent);
}
else {
var newParent = wrs_createElement('div', {}, creator);
newParent.appendChild(object);
toReturn = newParent.innerHTML;
newParent.removeChild(object);
}
return toReturn;
}
/**
* Parses end HTML code, converts CAS images to CAS applets.
* @param string code
* @return string
*/
function wrs_endParse(code) {
var containerCode = '<div>' + code + '</div>';
var container = wrs_createObject(containerCode);
var imgList = container.getElementsByTagName('img');
var convertToXml = false;
var convertToSafeXml = false;
if (window._wrs_conf_saveMode) {
if (_wrs_conf_saveMode == 'safeXml') {
convertToXml = true;
convertToSafeXml = true;
}
else if (_wrs_conf_saveMode == 'xml') {
convertToXml = true;
}
}
for (var i = 0; i < imgList.length; ++i) {
if (imgList[i].className == 'Wirisformula') {
if (convertToXml) {
var xmlCode = imgList[i].getAttribute(_wrs_conf_imageMathmlAttribute);
var replacementObject;
if (!convertToSafeXml) {
xmlCode = wrs_mathmlDecode(xmlCode);
var span = document.createElement('span');
span.innerHTML = xmlCode;
replacementObject = span.firstChild;
}
else {
replacementObject = document.createTextNode(xmlCode);
}
imgList[i].parentNode.replaceChild(replacementObject, imgList[i]);
--i; // One image has been deleted.
}
}
else if (imgList[i].className == 'Wiriscas') {
var appletCode = imgList[i].getAttribute(_wrs_conf_CASMathmlAttribute);
appletCode = wrs_mathmlDecode(appletCode);
var appletObject = wrs_createObject(appletCode);
appletObject.setAttribute('src', imgList[i].src);
var object = appletObject;
if (convertToSafeXml) {
object = document.createTextNode(wrs_mathmlEncode(wrs_createObjectCode(appletObject)));
}
imgList[i].parentNode.replaceChild(object, imgList[i]);
--i; // One image has been deleted.
}
}
return container.innerHTML;
}
/**
* Gets the formula mathml or CAS appletCode using its image hash code.
* @param string variableName Variable to send on POST query to the server.
* @param string imageHashCode
* @return string
*/
function wrs_getCode(variableName, imageHashCode) {
var data = wrs_urlencode(variableName) + '=' + imageHashCode;
var httpRequest = wrs_createHttpRequest();
if (httpRequest) {
if (_wrs_conf_getmathmlPath.substr(0, 1) == '/' || _wrs_conf_getmathmlPath.substr(0, 7) == 'http://' || _wrs_conf_getmathmlPath.substr(0, 8) == 'https://') {
httpRequest.open('POST', _wrs_conf_getmathmlPath, false);
}
else {
httpRequest.open('POST', _wrs_currentPath + _wrs_conf_getmathmlPath, false);
}
httpRequest.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=UTF-8');
httpRequest.send(data);
return httpRequest.responseText;
}
alert('Your browser is not compatible with AJAX technology. Please, use the latest version of Mozilla Firefox.');
return '';
}
/**
* Parses a text and replaces all HTML special characters by their entities.
* @param string input
* @return string
*/
function wrs_htmlentities(input) {
var container = document.createElement('span');
var text = document.createTextNode(input);
container.appendChild(text);
return container.innerHTML.split('"').join('&quot;');
}
/**
* Converts a hash to a HTTP query.
* @param hash properties
* @return string
*/
function wrs_httpBuildQuery(properties) {
var result = '';
for (i in properties) {
if (properties[i] != null) {
result += wrs_urlencode(i) + '=' + wrs_urlencode(properties[i]) + '&';
}
}
return result;
}
/**
* Parses initial HTML code, converts CAS applets to CAS images.
* @param string code
* @return string
*/
function wrs_initParse(code) {
if (window._wrs_conf_saveMode) {
var safeXml = (_wrs_conf_saveMode == 'safeXml');
var characters = _wrs_xmlCharacters;
if (safeXml) {
characters = _wrs_safeXmlCharacters;
code = wrs_parseSafeAppletsToObjects(code);
}
if (safeXml || _wrs_conf_saveMode == 'xml') {
// Converting XML to tags.
code = wrs_parseMathmlToImg(code, characters);
}
}
var container = wrs_createObject('<div>' + code + '</div>');
var appletList = container.getElementsByTagName('applet');
for (var i = 0; i < appletList.length; ++i) {
if (appletList[i].className == 'Wiriscas' || appletList[i].getAttribute('class') == 'Wiriscas') { // Internet Explorer can't read className correctly
var imgObject = wrs_createElement('img');
imgObject.title = 'Double click to edit';
imgObject.src = appletList[i].getAttribute('src');
imgObject.align = 'middle';
var appletCode = wrs_createObjectCode(appletList[i]);
imgObject.setAttribute(_wrs_conf_CASMathmlAttribute, wrs_mathmlEncode(appletCode));
imgObject.className = 'Wiriscas';
appletList[i].parentNode.replaceChild(imgObject, appletList[i]);
--i; // we have deleted one sleeped applet
}
}
return container.innerHTML;
}
/**
* WIRIS special encoding.
* We use these entities because IE doesn't support html entities on its attributes sometimes. Yes, sometimes.
* @param string input
* @return string
*/
function wrs_mathmlDecode(input) {
// Decoding entities.
input = input.split(_wrs_safeXmlCharactersEntities.tagOpener).join(_wrs_safeXmlCharacters.tagOpener);
input = input.split(_wrs_safeXmlCharactersEntities.tagCloser).join(_wrs_safeXmlCharacters.tagCloser);
input = input.split(_wrs_safeXmlCharactersEntities.doubleQuote).join(_wrs_safeXmlCharacters.doubleQuote);
// Decoding characters.
input = input.split(_wrs_safeXmlCharacters.tagOpener).join(_wrs_xmlCharacters.tagOpener);
input = input.split(_wrs_safeXmlCharacters.tagCloser).join(_wrs_xmlCharacters.tagCloser);
input = input.split(_wrs_safeXmlCharacters.doubleQuote).join(_wrs_xmlCharacters.doubleQuote);
input = input.split(_wrs_safeXmlCharacters.ampersand).join(_wrs_xmlCharacters.ampersand);
input = input.split(_wrs_safeXmlCharacters.quote).join(_wrs_xmlCharacters.quote);
// We are replacing $ by & for retrocompatibility. Now, the standard is replace § by &
input = input.split('$').join('&');
return input;
}
/**
* WIRIS special encoding.
* We use these entities because IE doesn't support html entities on its attributes sometimes. Yes, sometimes.
* @param string input
* @return string
*/
function wrs_mathmlEncode(input) {
input = input.split(_wrs_xmlCharacters.tagOpener).join(_wrs_safeXmlCharacters.tagOpener);
input = input.split(_wrs_xmlCharacters.tagCloser).join(_wrs_safeXmlCharacters.tagCloser);
input = input.split(_wrs_xmlCharacters.doubleQuote).join(_wrs_safeXmlCharacters.doubleQuote);
input = input.split(_wrs_xmlCharacters.ampersand).join(_wrs_safeXmlCharacters.ampersand);
input = input.split(_wrs_xmlCharacters.quote).join(_wrs_safeXmlCharacters.quote);
return input;
}
/**
* Converts special symbols (> 128) to entities.
* @param string mathml
* @return string
*/
function wrs_mathmlEntities(mathml) {
var toReturn = '';
for (var i = 0; i < mathml.length; ++i) {
//parsing > 128 characters
if (mathml.charCodeAt(i) > 128) {
toReturn += '&#' + mathml.charCodeAt(i) + ';';
}
else {
toReturn += mathml.charAt(i);
}
}
return toReturn;
}
/**
* Converts mathml to img object.
* @param object creator Object with "createElement" method
* @param string mathml Mathml code
* @return object
*/
function wrs_mathmlToImgObject(creator, mathml, wirisProperties) {
var imgObject = creator.createElement('img');
imgObject.title = 'Double click to edit';
imgObject.align = 'middle';
imgObject.className = 'Wirisformula';
var result = wrs_createImageSrc(mathml, wirisProperties);
if (window._wrs_conf_useDigestInsteadOfMathml && _wrs_conf_useDigestInsteadOfMathml) {
var parts = result.split(':', 2);
imgObject.setAttribute(_wrs_conf_imageMathmlAttribute, parts[0]);
imgObject.src = parts[1];
}
else {
imgObject.setAttribute(_wrs_conf_imageMathmlAttribute, wrs_mathmlEncode(mathml));
imgObject.src = result;
}
return imgObject;
}
/**
* Opens a new CAS window.
* @return object The opened window
*/
function wrs_openCASWindow() {
return window.open(_wrs_conf_CASPath, 'WIRISCAS', _wrs_conf_CASAttributes);
}
/**
* Opens a new editor window.
* @param string language Language code for the editor
* @return object The opened window
*/
function wrs_openEditorWindow(language) {
var path = _wrs_conf_editorPath;
if (language) {
path += '?lang=' + language;
}
return window.open(path, 'WIRISeditor', _wrs_conf_editorAttributes);
}
/**
* Converts all occurrences of mathml code to the corresponding image.
* @param string content
* @return string
*/
function wrs_parseMathmlToImg(content, characters) {
var output = '';
var mathTagBegin = characters.tagOpener + 'math';
var mathTagEnd = characters.tagOpener + '/math' + characters.tagCloser;
var start = content.indexOf(mathTagBegin);
var end = 0;
while (start != -1) {
output += content.substring(end, start);
end = content.indexOf(mathTagEnd, start);
if (end == -1) {
end = content.length - 1;
}
else {
end += mathTagEnd.length;
}
var mathml = content.substring(start, end);
mathml = (characters == _wrs_safeXmlCharacters) ? wrs_mathmlDecode(mathml) : wrs_mathmlEntities(mathml);
output += wrs_createObjectCode(wrs_mathmlToImgObject(document, mathml));
start = content.indexOf(mathTagBegin, end);
}
output += content.substring(end, content.length - 1);
return output;
}
/**
* Converts all occurrences of safe applet code to the corresponding code.
* @param string content
* @return string
*/
function wrs_parseSafeAppletsToObjects(content) {
var output = '';
var appletTagBegin = _wrs_safeXmlCharacters.tagOpener + 'applet';
var appletTagEnd = _wrs_safeXmlCharacters.tagOpener + '/applet' + _wrs_safeXmlCharacters.tagCloser;
var start = content.indexOf(appletTagBegin);
var end = 0;
while (start != -1) {
output += content.substring(end, start);
end = content.indexOf(appletTagEnd, start);
if (end == -1) {
end = content.length - 1;
}
else {
end += appletTagEnd.length;
}
output += wrs_mathmlDecode(content.substring(start, end));
start = content.indexOf(appletTagBegin, end);
}
output += content.substring(end, content.length - 1);
return output;
}
/**
* Cross-browser removeEventListener/detachEvent function.
* @param object element Element target
* @param event event Event
* @param function func Function to run
*/
function wrs_removeEvent(element, event, func) {
if (element.removeEventListener) {
element.removeEventListener(event, func, false);
}
else if (element.detachEvent) {
element.detachEvent('on' + event, func);
}
}
/**
* Inserts or modifies CAS on an iframe.
* @param object iframe Target
* @param string appletCode Applet code
* @param string image Base 64 image stream
* @param int imageWidth Image width
* @param int imageHeight Image height
*/
function wrs_updateCAS(iframe, appletCode, image, imageWidth, imageHeight) {
try {
if (iframe && appletCode) {
iframe.contentWindow.focus();
var imgObject = wrs_appletCodeToImgObject(iframe.contentWindow.document, appletCode, image, imageWidth, imageHeight);
if (_wrs_isNewElement) {
if (document.selection) {
var range = iframe.contentWindow.document.selection.createRange();
iframe.contentWindow.document.execCommand('insertimage', false, imgObject.src);
if (range.parentElement) {
var temporalImg = range.parentElement();
temporalImg.parentNode.insertBefore(imgObject, temporalImg);
temporalImg.parentNode.removeChild(temporalImg);
}
}
else {
var sel = iframe.contentWindow.getSelection();
try {
var range = sel.getRangeAt(0);
}
catch (e) {
var range = iframe.contentWindow.document.createRange();
}
sel.removeAllRanges();
range.deleteContents();
var node = range.startContainer;
var pos = range.startOffset;
if (node.nodeType == 3) {
node = node.splitText(pos);
node.parentNode.insertBefore(imgObject, node);
}
else if (node.nodeType == 1) {
node.insertBefore(imgObject, node.childNodes[pos]);
}
}
}
else {
_wrs_temporalImage.parentNode.insertBefore(imgObject, _wrs_temporalImage);
_wrs_temporalImage.parentNode.removeChild(_wrs_temporalImage);
}
}
}
catch (e) {
}
}
/**
* Inserts or modifies formulas on an iframe.
* @param object iframe Target
* @param string mathml Mathml code
*/
function wrs_updateFormula(iframe, mathml, wirisProperties) {
try {
if (iframe && mathml) {
iframe.contentWindow.focus();
var imgObject = wrs_mathmlToImgObject(iframe.contentWindow.document, mathml, wirisProperties);
if (_wrs_isNewElement) {
if (document.selection) {
var range = iframe.contentWindow.document.selection.createRange();
iframe.contentWindow.document.execCommand('insertimage', false, imgObject.src);
if (range.parentElement) {
var temporalImg = range.parentElement();
temporalImg.parentNode.insertBefore(imgObject, temporalImg);
temporalImg.parentNode.removeChild(temporalImg);
}
}
else {
var selection = iframe.contentWindow.getSelection();
try {
var range = selection.getRangeAt(0);
}
catch (e) {
var range = iframe.contentWindow.document.createRange();
}
selection.removeAllRanges();
range.deleteContents();
var node = range.startContainer;
var pos = range.startOffset;
if (node.nodeType == 3) {
node = node.splitText(pos);
node.parentNode.insertBefore(imgObject, node);
}
else if (node.nodeType == 1) {
node.insertBefore(imgObject, node.childNodes[pos]);
}
}
}
else {
_wrs_temporalImage.parentNode.insertBefore(imgObject, _wrs_temporalImage);
_wrs_temporalImage.parentNode.removeChild(_wrs_temporalImage);
}
}
}
catch (e) {
}
}
/**
* Inserts or modifies formulas or CAS on a textarea.
* @param object textarea Target
* @param string text Text to add in the textarea. For example, if you want to add the link to the image, you can call this function as wrs_updateTextarea(textarea, wrs_createImageSrc(mathml));
*/
function wrs_updateTextarea(textarea, text) {
if (textarea && text) {
textarea.focus();
if (textarea.selectionStart != null) {
textarea.value = textarea.value.substring(0, textarea.selectionStart) + text + textarea.value.substring(textarea.selectionEnd, textarea.value.length);
}
else {
var selection = document.selection.createRange();
selection.text = text;
}
}
}
/**
* URL encode function
* @param string clearString Input
* @return string
*/
function wrs_urlencode(clearString) {
var output = '';
var x = 0;
clearString = clearString.toString();
var regex = /(^[a-zA-Z0-9_.]*)/;
var clearString_length = ((typeof clearString.length) == 'function') ? clearString.length() : clearString.length;
while (x < clearString_length) {
var match = regex.exec(clearString.substr(x));
if (match != null && match.length > 1 && match[1] != '') {
output += match[1];
x += match[1].length;
}
else {
var charCode = clearString.charCodeAt(x);
var hexVal = charCode.toString(16);
output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
++x;
}
}
return output;
}

@ -1,94 +0,0 @@
var wrs_int_opener;
var closeFunction;
if (window.opener) { // For popup mode
wrs_int_opener = window.opener;
closeFunction = window.close;
}
/* FCKeditor integration begin */
else { // For iframe mode
wrs_int_opener = window.parent;
while (wrs_int_opener.InnerDialogLoaded) {
wrs_int_opener = wrs_int_opener.parent;
}
}
if (window.parent.InnerDialogLoaded) { // iframe mode
window.parent.InnerDialogLoaded();
closeFunction = window.parent.Cancel;
}
else if (window.opener.parent.FCKeditorAPI) { // popup mode
wrs_int_opener = window.opener.parent;
}
/* FCKeditor integration end */
wrs_int_opener.wrs_addEvent(window, 'load', function () {
var applet = document.getElementById('applet');
// Mathml content
if (!wrs_int_opener._wrs_isNewElement) {
var mathml;
if (wrs_int_opener._wrs_conf_useDigestInsteadOfMathml) {
mathml = wrs_int_opener.wrs_getCode(wrs_int_opener._wrs_conf_digestPostVariable, wrs_int_opener._wrs_temporalImage.getAttribute(wrs_int_opener._wrs_conf_imageMathmlAttribute));
}
else {
mathml = wrs_int_opener.wrs_mathmlDecode(wrs_int_opener._wrs_temporalImage.getAttribute(wrs_int_opener._wrs_conf_imageMathmlAttribute));
}
function setAppletMathml() {
// Internet explorer fails on "applet.isActive". It only supports "applet.isActive()"
try {
if (applet.isActive && applet.isActive()) {
applet.setContent(mathml);
}
else {
setTimeout(setAppletMathml, 50);
}
}
catch (e) {
if (applet.isActive()) {
applet.setContent(mathml);
}
else {
setTimeout(setAppletMathml, 50);
}
}
}
setAppletMathml();
}
// Button events
wrs_int_opener.wrs_addEvent(document.getElementById('submit'), 'click', function () {
var mathml = '';
if (!applet.isFormulaEmpty()) {
mathml += applet.getContent(); // if isn't empty, get mathml code to mathml variable
mathml = wrs_int_opener.wrs_mathmlEntities(mathml); // Apply a parse
}
/* FCKeditor integration begin */
if (window.parent.InnerDialogLoaded && window.parent.FCKBrowserInfo.IsIE) { // On IE, we must close the dialog for push the caret on the correct position.
closeFunction();
wrs_int_opener.wrs_int_updateFormula(mathml);
}
/* FCKeditor integration end */
else {
if (wrs_int_opener.wrs_int_updateFormula) {
wrs_int_opener.wrs_int_updateFormula(mathml);
}
closeFunction();
}
});
wrs_int_opener.wrs_addEvent(document.getElementById('cancel'), 'click', function () {
closeFunction();
});
});
wrs_int_opener.wrs_addEvent(window, 'unload', function () {
wrs_int_opener.wrs_int_notifyWindowClosed();
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 350 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

@ -1,336 +0,0 @@
/* FCKeditor configuration */
parent._wrs_conf_usePopUps = false;
parent._wrs_conf_editorWidth = 500;
parent._wrs_conf_editorHeight = 500;
parent._wrs_conf_CASWidth = 640;
parent._wrs_conf_CASHeight = 580;
/* Including core.js */
var script = parent.document.createElement('script');
script.type = 'text/javascript';
script.src = FCKConfig.PluginsPath + 'fckeditor_wiris/core/core.js';
parent.document.getElementsByTagName('head')[0].appendChild(script);
/* Configuration */
parent._wrs_conf_editorEnabled = true; // Specifies if fomula editor is enabled
parent._wrs_conf_CASEnabled = true; // Specifies if WIRIS CAS is enabled
parent._wrs_conf_imageMathmlAttribute = 'alt'; // Specifies the image tag where we should save the formula editor mathml code
parent._wrs_conf_CASMathmlAttribute = 'alt'; // Specifies the image tag where we should save the WIRIS CAS mathml code
parent._wrs_conf_editorPath = FCKConfig.PluginsPath + 'fckeditor_wiris/integration/editor.php'; // Specifies where is the editor HTML code (for popup window)
parent._wrs_conf_editorAttributes = 'width=500, height=400, scroll=no, resizable=yes'; // Specifies formula editor window options
parent._wrs_conf_CASPath = FCKConfig.PluginsPath + 'fckeditor_wiris/integration/cas.php'; // Specifies where is the WIRIS CAS HTML code (for popup window)
parent._wrs_conf_CASAttributes = 'width=640, height=480, scroll=no, resizable=yes'; // Specifies WIRIS CAS window options
parent._wrs_conf_useDigestInsteadOfMathml = false;
//parent._wrs_conf_digestPostVariable = 'digest';
parent._wrs_conf_createimagePath = FCKConfig.PluginsPath + 'fckeditor_wiris/integration/createimage.php'; // Specifies where is createimage script
parent._wrs_conf_createcasimagePath = FCKConfig.PluginsPath + 'fckeditor_wiris/integration/createcasimage.php'; // Specifies where is createcasimage script
//parent._wrs_conf_getmathmlPath = FCKConfig.PluginsPath + 'fckeditor_wiris/integration/getmathml.php'; // Specifies where is getmathml script
var _wrs_conf_saveMode = 'tags'; // this value can be 'tags', 'xml' or 'safeXml'.
/* Vars */
parent._wrs_int_editorIcon = FCKConfig.PluginsPath + 'fckeditor_wiris/core/wiris-formula.gif';
parent._wrs_int_CASIcon = FCKConfig.PluginsPath + 'fckeditor_wiris/core/wiris-cas.gif';
parent._wrs_int_temporalIframe;
parent._wrs_int_temporalImageResizing;
parent._wrs_int_wirisProperties;
parent._wrs_int_window;
parent._wrs_int_window_opened = false;
parent._wrs_int_language = 'en';
/* Plugin integration */
function whenDocReady(editorInstance, status) {
if (status == FCK_STATUS_COMPLETE) {
if (parent.wrs_initParse) {
editorInstance.SetData(parent.wrs_initParse(editorInstance.GetData()));
parent.wrs_addIframeEvents(editorInstance.EditingArea.IFrame, null, wrs_int_mousedownHandler, wrs_int_mouseupHandler);
}
else {
setTimeout(function () {
whenDocReady(editorInstance, status);
}, 50);
}
}
}
FCK.Events.AttachEvent('OnStatusChange', whenDocReady);
FCK.Events.AttachEvent('OnAfterLinkedFieldUpdate', function (editorInstance) {
var form = editorInstance.GetParentForm();
form[editorInstance.Name].value = parent.wrs_endParse(form[editorInstance.Name].value);
});
// FCKeditor disables WIRIS double click handlers. Using this method, we can handle it.
FCK.RegisterDoubleClickHandler(function (element) {
wrs_int_doubleClickHandler(parent._wrs_int_temporalIframe, element);
}, 'IMG');
if (parent._wrs_conf_editorEnabled) {
var WIRISFormulaCommand = function () {
}
WIRISFormulaCommand.prototype = new FCKUndefinedCommand();
WIRISFormulaCommand.prototype.Execute = function () {
parent._wrs_int_wirisProperties = {
'bgColor': FCK.Config['wirisimagebgcolor'],
'symbolColor': FCK.Config['wirisimagesymbolcolor'],
'transparency': FCK.Config['wiristransparency'],
'fontSize': FCK.Config['wirisimagefontsize'],
'numberColor': FCK.Config['wirisimagenumbercolor'],
'identColor': FCK.Config['wirisimageidentcolor']
};
wrs_int_openNewFormulaEditor(FCK.EditingArea.IFrame);
}
FCKCommands.RegisterCommand(
'fckeditor_wiris_openFormulaEditor',
new WIRISFormulaCommand()
);
FCKCommands.RegisterCommand(
'fckeditor_wiris_openFormulaEditor_aux',
new FCKDialogCommand(
'WIRIS editor',
'WIRIS editor',
parent._wrs_conf_editorPath,
500,
400
)
);
var formulaItem = new FCKToolbarButton('fckeditor_wiris_openFormulaEditor', 'WIRIS editor');
formulaItem.IconPath = parent._wrs_int_editorIcon;
FCKToolbarItems.RegisterItem(
'fckeditor_wiris_openFormulaEditor',
formulaItem
);
}
if (parent._wrs_conf_CASEnabled) {
var WIRISCASCommand = function () {
}
WIRISCASCommand.prototype = new FCKUndefinedCommand();
WIRISCASCommand.prototype.Execute = function () {
parent._wrs_int_language = FCK.Language.GetActiveLanguage();
wrs_int_openNewCAS(FCK.EditingArea.IFrame);
}
FCKCommands.RegisterCommand(
'fckeditor_wiris_openCAS',
new WIRISCASCommand()
);
var casItem = new FCKToolbarButton('fckeditor_wiris_openCAS', 'WIRIS CAS');
casItem.IconPath = parent._wrs_int_CASIcon;
FCKToolbarItems.RegisterItem(
'fckeditor_wiris_openCAS',
casItem
);
}
/**
* Opens formula editor.
* @param object iframe Target
*/
function wrs_int_openNewFormulaEditor(iframe) {
parent._wrs_isNewElement = true;
parent._wrs_int_temporalIframe = iframe;
if (parent._wrs_conf_usePopUps) {
if (parent._wrs_int_window_opened) {
parent._wrs_int_window.focus();
}
else {
parent._wrs_int_window_opened = true;
parent._wrs_int_window = window.open(parent._wrs_conf_editorPath, 'WIRISFormulaEditor', parent._wrs_conf_editorAttributes);
}
}
else {
FCKDialog.OpenDialog('WIRIS editor', 'WIRIS editor', parent._wrs_conf_editorPath, parent._wrs_conf_editorWidth, parent._wrs_conf_editorHeight);
wrs_int_hidePopUpButtons();
}
}
/**
* Opens CAS.
* @param object iframe Target
*/
function wrs_int_openNewCAS(iframe) {
parent._wrs_isNewElement = true;
parent._wrs_int_temporalIframe = iframe;
if (parent._wrs_conf_usePopUps) {
if (parent._wrs_int_window_opened) {
parent._wrs_int_window.focus();
}
else {
parent._wrs_int_window_opened = true;
parent._wrs_int_window = window.open(parent._wrs_conf_CASPath, 'WIRISCAS', parent._wrs_conf_CASAttributes);
}
}
else {
FCKDialog.OpenDialog('WIRIS CAS', 'WIRIS CAS', parent._wrs_conf_CASPath, parent._wrs_conf_CASWidth, parent._wrs_conf_CASHeight);
wrs_int_hidePopUpButtons();
}
}
/**
* Handles a double click on the iframe.
* @param object iframe Target
* @param object element Element double clicked
*/
function wrs_int_doubleClickHandler(iframe, element) {
if (element.nodeName.toLowerCase() == 'img') {
if (parent.wrs_containsClass(element, 'Wirisformula')) {
if (!parent._wrs_int_window_opened) {
parent._wrs_int_wirisProperties = {
'bgColor': FCK.Config['wirisimagebgcolor'],
'symbolColor': FCK.Config['wirisimagesymbolcolor'],
'transparency': FCK.Config['wiristransparency'],
'fontSize': FCK.Config['wirisimagefontsize'],
'numberColor': FCK.Config['wirisimagenumbercolor'],
'identColor': FCK.Config['wirisimageidentcolor']
};
parent._wrs_temporalImage = element;
wrs_int_openExistingFormulaEditor(iframe);
}
else {
parent._wrs_int_window.focus();
}
}
else if (parent.wrs_containsClass(element, 'Wiriscas')) {
if (!parent._wrs_int_window_opened) {
parent._wrs_temporalImage = element;
wrs_int_openExistingCAS(iframe);
}
else {
parent._wrs_int_window.focus();
}
}
}
}
/**
* Opens formula editor to edit an existing formula.
* @param object iframe Target
*/
function wrs_int_openExistingFormulaEditor(iframe) {
parent._wrs_isNewElement = false;
parent._wrs_int_temporalIframe = iframe;
if (parent._wrs_conf_usePopUps) {
parent._wrs_int_window_opened = true;
parent._wrs_int_window = window.open(parent._wrs_conf_editorPath, 'WIRISFormulaEditor', parent._wrs_conf_editorAttributes);
}
else {
FCKDialog.OpenDialog('WIRIS editor', 'WIRIS editor', parent._wrs_conf_editorPath, parent._wrs_conf_editorWidth, parent._wrs_conf_editorHeight);
wrs_int_hidePopUpButtons();
}
}
/**
* Opens CAS to edit an existing formula.
* @param object iframe Target
*/
function wrs_int_openExistingCAS(iframe) {
parent._wrs_isNewElement = false;
parent._wrs_int_temporalIframe = iframe;
if (parent._wrs_conf_usePopUps) {
parent._wrs_int_window_opened = true;
parent._wrs_int_window = window.open(parent._wrs_conf_CASPath, 'WIRISCAS', parent._wrs_conf_CASAttributes);
}
else {
FCKDialog.OpenDialog('WIRIS CAS', 'WIRIS CAS', parent._wrs_conf_CASPath, parent._wrs_conf_CASWidth, parent._wrs_conf_CASHeight);
wrs_int_hidePopUpButtons();
}
}
/**
* Handles a mouse down event on the iframe.
* @param object iframe Target
* @param object element Element mouse downed
*/
function wrs_int_mousedownHandler(iframe, element) {
parent._wrs_int_temporalIframe = iframe; // This allows to recognize de iframe for double click events.
if (element.nodeName.toLowerCase() == 'img') {
if (parent.wrs_containsClass(element, 'Wirisformula') || parent.wrs_containsClass(element, 'Wiriscas')) {
parent._wrs_int_temporalImageResizing = element;
}
}
}
/**
* Handles a mouse up event on the iframe.
*/
function wrs_int_mouseupHandler() {
if (parent._wrs_int_temporalImageResizing) {
setTimeout(function () {
parent._wrs_int_temporalImageResizing.removeAttribute('style');
parent._wrs_int_temporalImageResizing.removeAttribute('width');
parent._wrs_int_temporalImageResizing.removeAttribute('height');
}, 10);
}
}
/**
* Calls wrs_updateFormula with well params.
* @param string mathml
*/
parent.wrs_int_updateFormula = function (mathml) { // We need instance this function on parent object because core/editor.js only can access to the parent object.
parent.wrs_updateFormula(parent._wrs_int_temporalIframe, mathml, parent._wrs_int_wirisProperties);
}
/**
* Calls wrs_updateCAS with well params.
* @param string appletCode
* @param string image
* @param int width
* @param int height
*/
parent.wrs_int_updateCAS = function (appletCode, image, width, height) { // We need instance this function on parent object because core/cas.js only can access to the parent object.
parent.wrs_updateCAS(parent._wrs_int_temporalIframe, appletCode, image, width, height);
}
/**
* Handles window closing.
*/
parent.wrs_int_notifyWindowClosed = function () { // We need instance this function on parent object because core/editor.js only can access to the parent object.
parent._wrs_int_window_opened = false;
}
/*
* Hiddes popup buttons.
*/
function wrs_int_hidePopUpButtons() {
var cover = FCKDialog.GetCover();
if (cover) {
function hideCancelButton() {
var button = cover.nextSibling.contentWindow.document.getElementById('btnCancel');
if (button) {
//button.style.visibility = 'hidden'; // It runs on Firefox, but on IE it causes an unknown error. The ugly solution above works well:
button.style.position = 'absolute';
button.style.top = '1000px';
}
else {
setTimeout(hideCancelButton, 50);
}
}
hideCancelButton();
}
}

@ -1,94 +0,0 @@
<?php
include 'libwiris.php';
$config = wrs_loadConfig(WRS_CONFIG_FILE);
$availableLanguages = wrs_getAvailableCASLanguages($config['wiriscaslanguages']);
if (isset($_GET['mode']) && $_GET['mode'] == 'applet') {
if (isset($_GET['lang']) && in_array($_GET['lang'], $availableLanguages)) {
$language = $_GET['lang'];
}
else {
$language = $availableLanguages[0];
}
$codebase = wrs_replaceVariable($config['wiriscascodebase'], 'LANG', $language);
$archive = wrs_replaceVariable($config['wiriscasarchive'], 'LANG', $language);
$className = wrs_replaceVariable($config['wiriscasclass'], 'LANG', $language);
?>
<html>
<head>
<style type="text/css">
/*<!--*/
body {
overflow: hidden; // Hide scrollbars
}
/*-->*/
</style>
</head>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
<applet id="applet" alt="WIRIS CAS" codebase="<?php echo htmlentities($codebase, ENT_QUOTES, 'UTF-8'); ?>" archive="<?php echo htmlentities($archive, ENT_QUOTES, 'UTF-8'); ?>" code="<?php echo htmlentities($className, ENT_QUOTES, 'UTF-8'); ?>" width="100%" height="100%">
<p>You need JAVA&reg; to use WIRIS tools.<br />FREE download from <a target="_blank" href="http://www.java.com">www.java.com</a></p>
</applet>
</body>
</html>
<?php
}
else {
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="../core/cas.js"></script>
<title>WIRIS CAS</title>
<style type="text/css">
/*<!--*/
body {
overflow: hidden; // Hide scrollbars
}
/*-->*/
</style>
</head>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
<form id="optionForm">
<table height="100%" width="100%">
<tr>
<td id="appletContainer" colspan="5"></td>
</tr>
<tr height="1px">
<td>Width</td>
<td><input name="width" type="text" value="<?php echo $config['CAS_width']; ?>"/></td>
<td><input name="executeonload" type="checkbox"/> Calculate on load</td>
<td><input name="toolbar" type="checkbox" checked /> Show toolbar</td>
<td>
Language
<select id="languageList">
<?php
foreach ($availableLanguages as $language) {
$language = htmlentities($language, ENT_QUOTES, 'UTF-8');
echo '<option value="', $language, '">', $language, '</option>';
}
?>
</select>
</td>
</tr>
<tr height="1px">
<td>Height</td>
<td><input name="height" type="text" value="<?php echo $config['CAS_height']; ?>"/></td>
<td><input name="focusonload" type="checkbox"/> Focus on load</td>
<td><input name="level" type="checkbox"/> Elementary mode</td>
<td></td>
</tr>
<tr height="1px">
<td colspan="5"><input id="submit" value="Accept" type="button"/> <input id="cancel" value="Cancel" type="button"/></td>
</tr>
</table>
</form>
</body>
</html>
<?php
}
?>

@ -1,32 +0,0 @@
<?php
include 'libwiris.php';
$currentPath = dirname($_SERVER['PHP_SELF']) . '/';
if (isset($_POST['image'])) {
$fileName = md5($_POST['image']);
$formulaPath = WRS_FORMULA_DIRECTORY . '/' . $fileName . '.xml';
if (isset($_POST['mml']) && !is_file($formulaPath)) {
file_put_contents($formulaPath, $_POST['mml']);
}
$url = $currentPath . 'showcasimage.php?formula=' . $fileName . '.png';
$imagePath = WRS_CACHE_DIRECTORY . '/' . $fileName . '.png';
if (!is_file($imagePath)) {
if (file_put_contents($imagePath, base64_decode($_POST['image'])) !== false) {
echo $url;
}
else {
echo $currentPath . '../core/cas.gif';
}
}
else {
echo $url;
}
}
else {
echo $currentPath . '../core/cas.gif';
}
?>

@ -1,56 +0,0 @@
<?php
include 'libwiris.php';
if (!empty($_POST['mml'])) {
$toSave = $_POST['mml'] . "\n";
$config = wrs_loadConfig(WRS_CONFIG_FILE);
global $wrs_imageConfigProperties, $wrs_xmlFileAttributes;
foreach ($wrs_xmlFileAttributes as $serverParam) {
$configKey = $wrs_imageConfigProperties[$serverParam];
if (isset($_POST[$serverParam])) {
$config[$configKey] = $_POST[$serverParam];
}
if (isset($config[$configKey])) {
$toSave .= $config[$configKey] . "\n";
}
else {
$toSave .= "\n";
}
}
if (isset($config['wirisimagefontranges'])) {
$fontRanges = explode(',', $config['wirisimagefontranges']);
foreach ($fontRanges as $fontRangeName) {
$fontRangeName = trim($fontRangeName);
if (isset($config[$fontRangeName])) {
$toSave .= $config[$fontRangeName] . "\n";
}
}
}
$fileName = md5($toSave);
$url = dirname($_SERVER['PHP_SELF']) . '/showimage.php?formula=' . $fileName . '.png';
$filePath = WRS_FORMULA_DIRECTORY . '/' . $fileName . '.xml';
if (!is_file($filePath)) {
if (file_put_contents($filePath, $toSave) !== false) {
echo (isset($_POST['returnDigest']) && $_POST['returnDigest'] != 'false') ? $fileName . ':' . $url : $url;
}
else {
echo 'Error: can not create the image. Check your file privileges.';
}
}
else {
echo (isset($_POST['returnDigest']) && $_POST['returnDigest'] != 'false') ? $fileName . ':' . $url : $url;
}
}
else {
echo 'Error: no mathml has been sended.';
}
?>

@ -1,72 +0,0 @@
<?php
include 'libwiris.php';
$config = wrs_loadConfig(WRS_CONFIG_FILE);
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="../core/editor.js"></script>
<title>WIRIS Formula Editor</title>
<style type="text/css">
/*<!--*/
#manualLink {
float: right;
margin-right: 20px;
}
/*-->*/
</style>
</head>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="100%">
<tr height="100%">
<td>
<applet id="applet" codebase="<?php echo $config['wirisformulaeditorcodebase']; ?>" archive="<?php echo $config['wirisformulaeditorarchive']; ?>" code="<?php echo $config['wirisformulaeditorcode']; ?>" height="100%" width="100%">
<param name="menuBar" value="false"/>
<?php
$params = array(
'lang' => 'wirisformulaeditorlang',
'identMathvariant' => 'wirisimageidentmathvariant',
'numberMathvariant' => 'wirisimagenumbermathvariant',
'fontIdent' => 'wirisimagefontident',
'fontNumber' => 'wirisimagefontnumber',
'version' => 'wirisimageserviceversion'
);
foreach ($params as $key => $value) {
if (isset($config[$value])) {
echo '<param name="' . $key . '" value="' . $config[$value] . '" />';
}
}
if (isset($config['wirisimagefontranges'])) {
$fontRanges = explode(',', $config['wirisimagefontranges']);
$fontRangesCount = count($fontRanges);
for ($i = 0; $i < $fontRangesCount; ++$i) {
$fontRangeName = trim($fontRanges[$i]);
if (isset($config[$fontRangeName])) {
echo '<param name="font' . $i . '" value="' . $config[$fontRangeName] . '" />';
}
}
}
?>
<p>You need JAVA&reg; to use WIRIS tools.<br />FREE download from <a target="_blank" href="http://www.java.com">www.java.com</a></p>
</applet>
</td>
</tr>
<tr>
<td>
<a id="manualLink" href="http://www.wiris.com/portal/docs/editor-manual" target="_blank">Manual &gt;&gt;</a>
<input type="button" id="submit" value="Accept" />
<input type="button" id="cancel" value="Cancel" />
</td>
</tr>
</table>
</body>
</html>

@ -1,34 +0,0 @@
<?php
include 'libwiris.php';
$digest = NULL;
if (isset($_POST['md5']) && mb_strlen($_POST['md5']) == 32) { // Support for "generic simple" integration.
$digest = $_POST['md5'];
}
else if (isset($_POST['digest'])) { // Support for future integrations (where maybe they aren't using md5 sums).
$digest = $_POST['digest'];
}
if (!is_null($digest)) {
$filePath = WRS_FORMULA_DIRECTORY . '/' . basename($digest) . '.xml';
if (is_file($filePath)) {
if (($handle = fopen($filePath, 'r')) !== false) {
if (($line = fgets($handle)) !== false) {
echo $line;
}
fclose($handle);
}
else {
echo 'Error: can not read the formula. Check your file privileges.';
}
}
else {
echo 'Error: formula does not exists.';
}
}
else {
echo 'Error: no digest has been sended.';
}
?>

@ -1,93 +0,0 @@
<?php
define('WRS_CONFIG_FILE', '../configuration.ini');
define('WRS_CACHE_DIRECTORY', '../cache');
define('WRS_FORMULA_DIRECTORY', '../formulas');
global $wrs_imageConfigProperties, $wrs_xmlFileAttributes;
$wrs_imageConfigProperties = array(
'bgColor' => 'wirisimagebgcolor',
'symbolColor' => 'wirisimagesymbolcolor',
'transparency' => 'wiristransparency',
'fontSize' => 'wirisimagefontsize',
'numberColor' => 'wirisimagenumbercolor',
'identColor' => 'wirisimageidentcolor',
'identMathvariant' => 'wirisimageidentmathvariant',
'numberMathvariant' => 'wirisimagenumbermathvariant',
'fontIdent' => 'wirisimagefontident',
'fontNumber' => 'wirisimagefontnumber',
'version' => 'wirisimageserviceversion'
);
$wrs_xmlFileAttributes = array(
'bgColor',
'symbolColor',
'transparency',
'fontSize',
'numberColor',
'identColor',
'identMathvariant',
'numberMathvariant',
'fontIdent',
'fontNumber'
);
function wrs_getAvailableCASLanguages($languageString) {
$availableLanguages = explode(',', $languageString);
for ($i = count($availableLanguages) - 1; $i >= 0; --$i) {
$availableLanguages[$i] = trim($availableLanguages[$i]);
}
// At least we should accept an empty language.
if (!isset($availableLanguages[0])) {
$availableLanguages[] = '';
}
return $availableLanguages;
}
function wrs_loadConfig($file) {
$handle = fopen($file, 'r');
if ($handle === false) {
return array();
}
$toReturn = array();
while (($line = fgets($handle)) !== false) {
$lineWords = explode('=', $line, 2);
if (isset($lineWords[1])) {
$key = trim($lineWords[0]);
$value = trim($lineWords[1]);
$toReturn[$key] = $value;
}
}
fclose($handle);
return $toReturn;
}
function wrs_replaceVariable($value, $variableName, $variableValue) {
return str_replace('%' . $variableName, $variableValue, $value);
}
function wrs_secureStripslashes($element) {
if (is_array($element)) {
return array_map('wrs_secureStripslashes', $element);
}
return stripslashes($element);
}
@set_magic_quotes_runtime(0);
if (get_magic_quotes_gpc() == 1) {
$_REQUEST = array_map('wrs_secureStripslashes', $_REQUEST);
$_GET = array_map('wrs_secureStripslashes', $_GET);
$_POST = array_map('wrs_secureStripslashes', $_POST);
}
?>

@ -1,20 +0,0 @@
<?php
include 'libwiris.php';
if (empty($_GET['formula'])) {
echo 'Error: no image name has been sended.';
}
else {
$formula = basename($_GET['formula']);
$filePath = WRS_CACHE_DIRECTORY . '/' . $formula;
if (is_file($filePath)) {
header('Content-Type: image/png');
readfile($filePath);
}
else {
header('Content-Type: image/gif');
readfile('../core/cas.gif');
}
}
?>

@ -1,100 +0,0 @@
<?php
include 'libwiris.php';
function createImage($config, $formulaPath, $imagePath) {
if (is_file($formulaPath) && ($handle = fopen($formulaPath, 'r')) !== false) {
$fonts = array();
if (($line = fgets($handle)) !== false) {
$mathml = trim($line);
global $wrs_imageConfigProperties, $wrs_xmlFileAttributes;
$i = 0;
$wrs_xmlFileAttributesCount = count($wrs_xmlFileAttributes);
while (($line = fgets($handle)) !== false && $i < $wrs_xmlFileAttributesCount) {
$config[$wrs_imageConfigProperties[$wrs_xmlFileAttributes[$i]]] = trim($line);
++$i;
}
$i = 0;
while (($line = fgets($handle)) !== false) {
$line = trim($line);
if (isset($line[0])) {
$fonts['font' . $i] = $line;
++$i;
}
}
}
else {
$mathml = '';
}
fclose($handle);
// Retrocompatibility: when wirisimagenumbercolor is not defined
if (!isset($config['wirisimagenumbercolor']) && isset($config['wirisimagesymbolcolor'])) {
$config['wirisimagenumbercolor'] = $config['wirisimagesymbolcolor'];
}
// Retrocompatibility: when wirisimageidentcolor is not defined
if (!isset($config['wirisimageidentcolor']) && isset($config['wirisimagesymbolcolor'])) {
$config['wirisimageidentcolor'] = $config['wirisimagesymbolcolor'];
}
$properties = array('mml' => $mathml);
foreach ($wrs_imageConfigProperties as $serverParam => $configKey) {
if (isset($config[$configKey])) {
$properties[$serverParam] = $config[$configKey];
}
}
$postdata = http_build_query($fonts, '', '&') . '&' . http_build_query($properties, '', '&');
$contextArray = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8',
'content' => $postdata
)
);
if (isset($config['wirisproxy']) && $config['wirisproxy'] == 'true') {
$contextArray['http']['proxy'] = 'tcp://' . $config['wirisproxy_host'] . ':' . $config['wirisproxy_port'];
$contextArray['http']['request_fulluri'] = true;
}
$context = stream_context_create($contextArray);
if (($response = file_get_contents('http://' . $config['wirisimageservicehost'] . ':' . $config['wirisimageserviceport'] . $config['wirisimageservicepath'], false, $context)) === false) {
return false;
}
file_put_contents($imagePath, $response);
return true;
}
return false;
}
if (empty($_GET['formula'])) {
echo 'Error: no image name has been sended.';
}
else {
$formula = rtrim(basename($_GET['formula']), '.png');
$imagePath = WRS_CACHE_DIRECTORY . '/' . $formula . '.png';
$config = wrs_loadConfig(WRS_CONFIG_FILE);
if (is_file($imagePath) || createImage($config, WRS_FORMULA_DIRECTORY . '/' . $formula . '.xml', $imagePath)) {
header('Content-Type: image/png');
readfile($imagePath);
}
else {
echo 'Error creating the image.';
}
}
?>

@ -0,0 +1,3 @@
Installing this plugin you get WIRIS editor and WIRIS CAS.
This activation is not fully realized unless it has been previously downloaded the PHP plugin for FCKeditor WIRIS (http://www.wiris.com/plugins/editors/download?filter=fckeditor) and unzipped its contents in the Chamilo's directory main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/
This is necessary because Wiris is proprietary software and his services are commercial (http://www.wiris.com/store/who-pays). To make adjustments to the plugin, edit configuration.ini file or replace his content by configuration.ini.default Chamilo file.

@ -1289,7 +1289,7 @@ $SSOServerUnAuthURIComment = "The address of the page on the server that logs th
$SSOServerProtocolTitle = "Single Sign On server's protocol";
$SSOServerProtocolComment = "The protocol string to prefix the Single Sign On server's domain (we recommend you use https:// if your server is able to provide this feature, as all non-secure protocols are dangerous for authentication matters)";
$EnabledWirisTitle = "WIRIS mathematical editor";
$EnabledWirisComment = "Enable WIRIS mathematical editor";
$EnabledWirisComment = "Enable WIRIS mathematical editor. Installing this plugin you get WIRIS editor and WIRIS CAS. <br/>This activation is not fully realized unless it has been previously downloaded the <a href=\"http://www.wiris.com/plugins/editors/download?filter=fckeditor\" target=\"_blank\">PHP plugin for FCKeditor WIRIS</a> and unzipped its contents in the Chamilo's directory main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/ <br/>This is necessary because Wiris is proprietary software and his services are <a href=\"http://www.wiris.com/store/who-pays\" target=\"_blank\">commercial</a>. To make adjustments to the plugin, edit configuration.ini file or replace his content by configuration.ini.default Chamilo file.";
$AllowSpellCheckTitle = "Spell check";
$AllowSpellCheckComment = "Enable spell check";
$EnabledSVGTitle = "Create and edit SVG files";

@ -1289,7 +1289,7 @@ $SSOServerUnAuthURIComment = "Dirección de la página del servidor que desconec
$SSOServerProtocolTitle = "Protocolo del servidor Single Sign On";
$SSOServerProtocolComment = "Prefijo que indica el protocolo del dominio del servidor de Single Sign On (si su servidor lo permite, recomendamos https:// pues protocolos no seguros son un peligro para un sistema de autentificación)";
$EnabledWirisTitle = "Editor matemático WIRIS";
$EnabledWirisComment = "Habilitar el editor matemático WIRIS";
$EnabledWirisComment = "Activar el editor matemático WIRIS. Instalando este plugin obtendrá WIRIS editor y WIRIS CAS. <br/>La activación no se realiza completamente si previamente no ha descargado el <a href=\"http://www.wiris.com/plugins/editors/download?filter=fckeditor\" target=\"_blank\">PHP plugin for FCKeditor de WIRIS</a> y descomprimido su contenido en el directorio de Chamilo main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/ <br/>Esto es necesario debido a que Wiris es un software propietario y los servicios de Wiris son <a href=\"http://www.wiris.com/store/who-pays\" target=\"_blank\">comerciales</a>. Para realizar ajustes en el plugin edite el archivo configuration.ini o sustituya su contenido por el de configuration.ini.default que acompaña a Chamilo.";
$AllowSpellCheckTitle = "Corrector ortográfico";
$AllowSpellCheckComment = "Activar el corrector ortográfico";
$EnabledSVGTitle = "Creación y edición de archivos SVG";

Loading…
Cancel
Save