commit
dca44bda4f
@ -0,0 +1 @@ |
||||
1.14.3 |
||||
@ -0,0 +1 @@ |
||||
deny from all |
||||
@ -0,0 +1,8 @@ |
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
||||
<head> |
||||
</head> |
||||
<body> |
||||
<br /> |
||||
</body> |
||||
</html> |
||||
@ -0,0 +1,68 @@ |
||||
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 = |
||||
|
After Width: | Height: | Size: 24 KiB |
@ -0,0 +1,231 @@ |
||||
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(); |
||||
}); |
||||
@ -0,0 +1,8 @@ |
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
||||
<head> |
||||
</head> |
||||
<body> |
||||
<br /> |
||||
</body> |
||||
</html> |
||||
|
After Width: | Height: | Size: 350 B |
|
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,334 @@ |
||||
/* 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
|
||||
|
||||
/* 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 Formula Editor', |
||||
'WIRIS Formula Editor', |
||||
parent._wrs_conf_editorPath, |
||||
500, |
||||
400 |
||||
) |
||||
); |
||||
|
||||
var formulaItem = new FCKToolbarButton('fckeditor_wiris_openFormulaEditor', 'WIRIS Formula 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 Formula Editor', 'WIRIS Formula 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 Formula Editor', 'WIRIS Formula Editor', 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 Formula Editor', 'WIRIS Formula 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 Formula Editor', 'WIRIS Formula Editor', 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(); |
||||
} |
||||
} |
||||
@ -0,0 +1 @@ |
||||
deny from all |
||||
@ -0,0 +1,8 @@ |
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
||||
<head> |
||||
</head> |
||||
<body> |
||||
<br /> |
||||
</body> |
||||
</html> |
||||
@ -0,0 +1,8 @@ |
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
||||
<head> |
||||
</head> |
||||
<body> |
||||
<br /> |
||||
</body> |
||||
</html> |
||||
@ -0,0 +1,94 @@ |
||||
<?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® 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"/> Show toolbar</td><!--Chamilo delete default checked --> |
||||
<!-- --> |
||||
<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 |
||||
} |
||||
?> |
||||
@ -0,0 +1,32 @@ |
||||
<?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'; |
||||
} |
||||
?> |
||||
@ -0,0 +1,34 @@ |
||||
<?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.'; |
||||
} |
||||
?> |
||||
@ -0,0 +1,8 @@ |
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
||||
<head> |
||||
</head> |
||||
<body> |
||||
<br /> |
||||
</body> |
||||
</html> |
||||
@ -0,0 +1,93 @@ |
||||
<?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); |
||||
} |
||||
?> |
||||
@ -0,0 +1,20 @@ |
||||
<?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'); |
||||
} |
||||
} |
||||
?> |
||||
@ -0,0 +1,100 @@ |
||||
<?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.'; |
||||
} |
||||
} |
||||
?> |
||||
Loading…
Reference in new issue