|
WIRIS Formula Editor Formula and CAS plugins
WIRIS CAS WIRIS Quizzes |
1
Generic
WIRIS plugin guide
1.1 Introduction
This
document will provide assistance to those developers who want to integrate
WIRIS Formula Editor and CAS in their platforms and there is not a specific plugin already available. More precisely this document
covers two scenarios:
Before
staring any development, please, ensure that there is no plugin
already available for your needs. See Formula and CAS plugin’s. Note: you should have a valid license to install the
plugin in a production environment; otherwise, you
can use the downloaded file just for demo purposes. To acquire the full rights
license, please contact to info@wiris.com
or visit www.wiris.com. 1.2 Prerequisites
1.3 Starting
1.3.1
On
PHP and ASP.NET integrations
The first
step is copying pluginwiris directory (next to this readme
file) in your web system root path. Then, open pluginwiris/configuration.ini and set these fields: 1.3.2
On
Java integration
(1) The WIRIS plugin
needs to access an external server to get additional resources (formula editor
applet, image service and WIRIS CAS). See architecture
for more information. The default configuration connects to services.wiris.com
to get such services. However, you might consider acquiring a production
access. Under certain circumstances it is possible to install all necessary
services in the customer server (not only the plugin). 1.3.3 For ASP.NET servers
If you are
using PluginWIRIS for ASP.NET version, you must create
an application on your IIS through your control panel. The application root
directory depends on the PluginWIRIS package that you
have downloaded.
How to
create applications: http://support.microsoft.com/kb/172138 1.4 Rules
There are
some rules for plugin develop:
1.5 Important complementary information
PluginWIRIS
follows this criterion:
You can use
this example code to load your implementation: <script type="text/javascript"
src="./pluginwiris/core/core.js"></script> Then, you
can use this example code to start pluginwiris when
your editor is loaded: wrs_int_init(<your
wrs_int_params, see integration.js>); 1.6 Environment variables
PluginWIRIS
core uses three global variables that you should use/modify:
1.7 Functions
There are the
core functions that you can use (but not modify!). There are in pluginwiris/core/core.js. wrs_addEvent(element, event, func); Cross-browser addEventListener/attachEvent function. @param
object element Element target @param
event event Event @param
function func Function to run wrs_removeEvent(element, event, func); Cross-browser removeEventListener/detachEvent function. @param object element Element target @param
event event Event @param
function func Function to run wrs_addIframeEvents(iframe, doubleClickHandler,
mousedownHandler, mouseupHandler); 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 wrs_addTextareaEvents(textarea, clickHandler); Adds textarea events. @param object textarea
Target @param
function clickHandler Function to run when user
clicks the textarea wrs_mathmlDecode(input); WIRIS special
encoding. We use these entities because IE
doesn’t support html entities on its attributes. @param
string input @return string wrs_mathmlEncode(input); WIRIS special encoding. We use these entities because IE
doesn’t support html entities on its attributes. @param
string input @return string wrs_mathmlEntities(mathml); Converts special
symbols (> 128) to entities. @param
string mathml @return string wrs_updateFormula(iframe, mathml); Inserts or modifies formulas. @param
object iframe Target @param
string mathml Mathml code wrs_updateCAS(iframe, appletCode,
image, imageWidth, imageHeight); Inserts or modifies CAS. @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 wrs_updateTextarea(textarea, text); 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)); wrs_mathmlToImgObject(creator, mathml); Converts mathml to img object. @param object creator Object with “createElement” method @param
string mathml Mathml code @return object wrs_createImageSrc(mathml); Gets formula image
src with @param mathml Mathml code @return string wrs_appletCodeToImgObject(creator, appletCode,
image, imageWidth, imageHeight); 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 wrs_createImageCASSrc(image); Gets CAS image src with @param
string image Base 64 image stream @return string wrs_urlencode(clearString); URL encode
function. @param string clearString Input @return string wrs_createHttpRequest(); Cross-browser httpRequest creation. @return object wrs_getCode(imageMd5); Gets the formula mathml
or CAS appletCode using its image md5 sum. @param string imageMd5 Image md5 sum. @return string wrs_createObject(objectCode); Creates new object
using its html code. @param
string objectCode @return object wrs_createObjectCode(object); Converts an object
to its HTML code. @param
object object @return string wrs_initParse(code); Parses initial HTML code, converts
CAS applets to CAS images. @param string code @return string wrs_endParse(code); Parses end HTML code, converts CAS
images to CAS applets. @param
string code @return string 1.8 About demonstrations
We have
some WIRIS Plugin demonstrations. You can download
these demonstrations and read the code to know how Plugin
WIRIS really works. Also, you can integrate this code on your own platform. Available
demonstrations:
|