Index: lams_central/web/fckeditor/editor/plugins/equation/equation.gif =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/Attic/equation.gif,v diff -u Binary files differ Index: lams_central/web/fckeditor/editor/plugins/equation/fckplugin.js =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/Attic/fckplugin.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_central/web/fckeditor/editor/plugins/equation/fckplugin.js 21 Jan 2009 04:00:48 -0000 1.1 @@ -0,0 +1,213 @@ +var latexpath='/latexrender/pictures/'; + +// Latex equation editor + +var InsertEquationCommand=function(){}; + +InsertEquationCommand.prototype.Execute=function(){ } + +InsertEquationCommand.GetState=function() { + return FCK_TRISTATE_OFF; //we dont want the button to be toggled +} + +var popupEqnwin = null; +InsertEquationCommand.Execute=function() +{ + //open a popup window when the button is clicked + if (popupEqnwin==null || popupEqnwin.closed || !popupEqnwin.location) + { + popupEqnwin= window.open( FCKConfig.PluginsPath + 'equation/editor/editor.html', 'Equation', 'width=700,height=450,status=1,scrollbars=no,resizable=1,location=no,toolbar=no'); + } + popupEqnwin.focus(); +} + +// Register the related command. +FCKCommands.RegisterCommand( 'Equation', InsertEquationCommand ) ; + +// Create the "Placeholder" toolbar button. +var oEquationItem = new FCKToolbarButton( 'Equation', FCKLang['EquationBtn'] ) ; +oEquationItem.IconPath = FCKConfig.PluginsPath + 'equation/equation.gif' ; + +FCKToolbarItems.RegisterItem( 'Equation', oEquationItem ) ; + + +// The object used for all Placeholder operations. +var FCKEquation= new Object() ; + +// Add a new placeholder at the actual selection. +// +FCKEquation.Add = function( name ) +{ +// var oImage = FCK.CreateElement( 'img' ) ; + var oImage = FCK.InsertElement( 'img' ) ; + this.SetupImage( oImage, name ) ; +// Then select the new placeholder + FCKSelection.SelectNode(oImage); +} + +FCKEquation.SetupImage = function( image, name ) +{ + var sName = name.match( /\\f([\[\$])(.*?)\\f[\]\$]/ ); + var eq=''; + + eq = escape(sName[2].replace(/\+/g,'+')); + if(sName[1]=='$') + { eq='\\inline&space;'+eq; } + else + { + image.style.display='block'; + image.style.margin='0 auto'; + image.style.textalign='center'; + } + + image.src = 'http://www.codecogs.com/png.latex?'+eq; + image.style.backgroundColor = '#ffffdd' ; + image.align='absmiddle'; + image.alt=name; + image.title=name; + + if ( FCKBrowserInfo.IsGecko ) + image.style.cursor = 'default' ; + + image._fckequation = name; + image.contentEditable = false ; + + // To avoid it to be resized. + image.onresizestart = function() + { + FCK.EditorWindow.event.returnValue = false ; + return false ; + } +} + +// On Gecko we must do this trick so the user select all the IMG when clicking on it. +FCKEquation._SetupClickListener = function() +{ + FCKEquation._ClickListener = function( e ) + { + if ( e.target.tagName == 'IMG' && e.target._fckequation ) + FCKSelection.SelectNode( e.target ) ; + } + + FCK.EditorDocument.addEventListener( 'click', FCKEquation._ClickListener, true ) ; +} + +// Open the Placeholder dialog on double click. +FCKEquation.OnDoubleClick = function( image ) +{ + if ( image.tagName == 'IMG' && image._fckequation ) + FCKCommands.GetCommand( 'Equation' ).Execute() ; +} + +FCK.RegisterDoubleClickHandler( FCKEquation.OnDoubleClick, 'IMG' ) ; + +// Check if a Placholder name is already in use. +FCKEquation.Exist = function( name ) +{ + var aImages = FCK.EditorDocument.getElementsByTagName( 'IMG' ) + + for ( var i = 0 ; i < aImages.length ; i++ ) + { + if ( aIMGs[i]._fckequation == name ) + return true ; + } +} + +if ( FCKBrowserInfo.IsIE ) +{ + FCKEquation.Redraw = function() + { + if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG ) + return ; + + var aEquations = FCK.EditorDocument.body.innerText.match( /\\f[\[\$].*?\\f[\]\$]/g ) ; + if ( !aEquations ) + return ; + + var oRange = FCK.EditorDocument.body.createTextRange() ; + + for ( var i = 0 ; i < aEquations.length ; i++ ) + { + if ( oRange.findText( aEquations[i] ) ) + { + var sName = aEquations[i].match( /\\f([\[\$])(.*?)\\f[\]\$]/ ); + + var eq = escape(sName[2].replace(/\+/g,'+')); + var extrastyle=''; + if(sName[1]=='$') + eq='\\inline&space;'+eq; + // else + // extrastyle=' display:block; margin:0 auto;'; + + imgsrc = '/eq.latex?'+eq; + + oRange.pasteHTML( '') ; + } + } + } +} +else +{ + FCKEquation.Redraw = function() + { + if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG ) + return ; + + var oInteractor = FCK.EditorDocument.createTreeWalker( FCK.EditorDocument.body, NodeFilter.SHOW_TEXT, FCKEquation._AcceptNode, true ) ; + + var aNodes = new Array() ; + + while ( (oNode = oInteractor.nextNode()) ) + { + aNodes[ aNodes.length ] = oNode ; + } + + for ( var n = 0 ; n < aNodes.length ; n++ ) + { + var aPieces = aNodes[n].nodeValue.split( /(\\f[\[\$].*?\\f[\]\$])/g ) ; + + for ( var i = 0 ; i < aPieces.length ; i++ ) + { + if ( aPieces[i].length > 0 ) + { + if ( aPieces[i].indexOf( '\\f[' ) == 0 || aPieces[i].indexOf( '\\f$' ) == 0) + { + var sName = aPieces[i].match( /(\\f[\[\$].*?\\f[\]\$])/ )[1] ; + + var oImage = FCK.EditorDocument.createElement( 'img' ) ; + FCKEquation.SetupImage( oImage, sName ) ; + + aNodes[n].parentNode.insertBefore( oImage, aNodes[n] ) ; + } + else + aNodes[n].parentNode.insertBefore( FCK.EditorDocument.createTextNode( aPieces[i] ) , aNodes[n] ) ; + } + } + + aNodes[n].parentNode.removeChild( aNodes[n] ) ; + } + + FCKEquation._SetupClickListener() ; + } + + FCKEquation._AcceptNode = function( node ) + { + if ( /\\f[\[\$].*?\\f[\]\$]/.test( node.nodeValue ) ) + return NodeFilter.FILTER_ACCEPT ; + else + return NodeFilter.FILTER_SKIP ; + } +} + +FCK.Events.AttachEvent( 'OnAfterSetHTML', FCKEquation.Redraw ) ; + +// Must include the seperate plugin called TagProcessors; that contains +/* + + if ( htmlNode._fckequation ) + { + alert('Bye Bye Equation' + htmlNode._fckeauation); + node = FCKXHtml.XML.createTextNode( unescape(htmlNode._fckequation) ) ; + } + +*/ \ No newline at end of file Index: lams_central/web/fckeditor/editor/plugins/equation/editor/editor.html =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/Attic/editor.html,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_central/web/fckeditor/editor/plugins/equation/editor/editor.html 21 Jan 2009 04:00:48 -0000 1.1 @@ -0,0 +1,471 @@ + + + + +LaTeX Equation Editor for the Internet + + + + + + + + + + + + + + +
+
+
+ + + + + + +    help +
+
+undo +redo + + + + + +
+ +
+
+
+ +Operators Panel + +\frac{a}{b} +a^b +a_b +\frac{\\partial }{\\partial x} + +\int +\int_a^b +\oint_a^b +\lim_{x \rightarrow 0} + +\prod +\prod_a^b +\coprod +\coprod_a^b + +\bigcap +\bigcap_a^b +\bigcup +\bigcup_a^b + +\sum +\sum_a^b +\sqrt{x} +\sqrt[n]{x} + +
+ +
+ +Brackets Panel + + +\left( \right) +\left[ \right] +\left| \right| +\left< \right> +\left\{ \right\} + + +
+ +
+ +Greek Letters Panel + +\alpha +\beta +\gamma +\delta +\epsilon +\varepsilon + +\zeta +\eta +\theta +\vartheta +\iota +\kappa + +\lambda +\mu +\nu +\xi +\pi +\varpi + +\rho +\varrho +\sigma +\varsigma +\tau +\upsilon + +\phi +\varphi +\chi +\psi +\omega + +\Gamma +\Delta +\Theta +\Lambda +\Xi +\Pi + +\Sigma +\Upsilon +\Phi +\Psi +\Omega + +
+ +
+ +Relations Panel + +\leq +\prec +\preceq +\ll +\subset +\subseteq +\sqsubset +\sqsubseteq +\in +\vdash +\models +\bowtie + + +\geq +\succ +\succeq +\gg +\supset +\supseteq +\sqsupset +\sqsupseteq +\ni +\dashv +\perp +\Join + + +\neq +\equiv +\doteq +\sim +\approx +\simeq +\cong +\asymp +\propto +\mid +\parallel + +
+ +
+ +Accents Panel + + + + + + + + +
+ +
+ +Accents Panel + +\hat{a} +\check{a} +\tilde{a} +\acute{a} +\grave{a} + +\dot{a} +\ddot{a} +\breve{a} +\bar{a} +\vec{a} + + +
+ +
+ +Matrix Panel + +\begin{matrix} ... \end{matrix} +\begin{pmatrix} ... \end{pmatrix} +\begin{vmatrix} ... \end{vmatrix} +\begin{Vmatrix} ... \end{Vmatrix} +\left.\begin{matrix}... \end{matrix}\right| + +\being{bmatrix} ... \end{bmatrix} +\bigl(\begin{smallmatrix} ... \end{smallmatrix}\bigr) +\begin{Bmatrix} ... \end{Bmatrix} +\begin{Bmatrix} ... \end{matrix} +\begin{matrix} ... \end{Bmatrix} + +\begin{cases} ... \end{cases} +\begin{align} ... \end{align} + +
+ +
+
+ + +
+ +
+ + + + + +
+
+ + + +
+ +
Type your LaTeX equation in the box above and click Render Expression to see it displayed here.
+ + + +
+ + + + + \ No newline at end of file Index: lams_central/web/fckeditor/editor/plugins/equation/editor/css/equation.css =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/css/Attic/equation.css,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_central/web/fckeditor/editor/plugins/equation/editor/css/equation.css 21 Jan 2009 04:00:48 -0000 1.1 @@ -0,0 +1,79 @@ +/* The default text style used on every page */ +body { + padding:0; + margin:0; + font-size:12px; + font-family:Arial, Helvetica, sans-serif; +} + +p { margin:2px 0; } + +#language { position:absolute; left:0px; width:32px; font-size:1px; line-height:1px; } +#language img { width:30px; height:17px; padding:1px; margin:0; } + +#hover { padding:2px; position:absolute; display:none; z-index:10; background-color:#FFFFCC; border:1px solid #999999; } + +.yellowbox { width:450px; border:1px solid #dddddd; background-color:#FFFFCC; padding:5px; margin:5px auto; } + +.center { margin:0 auto; text-align:center; } + +.top { margin:0 auto; padding:2px 0; background-color:#eeeeee; width:95%; border-right:1px solid #9a9a9a; } +.bottom { border-bottom:1px solid #9a9a9a; } +#toolbar_wrapper { width:530px; margin:0px auto; text-align:left; } +#toolbar { + position:absolute; + width: 530px; + padding-top:2px; +} +#toolbar_space { height:36px; width:95%; margin:0 auto; background-color:#eeeeee; border-right:1px solid #9a9a9a; } +.panel { float:left; padding:0px 3px; z-index:10; height:24px; overflow:hidden; } +.panel2 { float:left; padding:0px 3px; z-index:10; height:30px; overflow:hidden; } + +#latex_formula +{ height:100px; + /* overflow:hidden; // Use if you also enable autoresize box */ +} +#equationcomment { margin:10px; } +#equationview { margin:10px; } +#footer { position:absolute; width:100%; bottom:2px; text-align:center; } + +form { border:0; padding:0; margin:0; } + +a, a:visited { color:#280092 } +a:visited:hover, a:link:hover { color: #ff6501; text-decoration:underline } +a img { border:0 none; } + +select +{ + font-family:"lucida grande", tahoma, verdana, arial, sans-sarif; + font-size:11px; + background-color:#FFFFFF; + border:1px solid #8FB6BD; + height:18px; +} +textarea { border:1px solid #8FB6BD; width:95% } +textarea:focus { background-color:#FFFFCC; } + +/* ------- Button formating ------ */ + +.bluebutton, .lightbluebutton, .greybutton { + border-style: solid; + border-width:1px; + border-top-color: #D9DFEA; + border-left-color: #D9DFEA; + border-bottom-color: #0e1f5b; + border-right-color: #0e1f5b; + color: #FFFFFF; + font-size: 11px; + font-family: "lucida grande", tahoma, verdana, arial, sans-serif; + text-align: center; + cursor:pointer; + /*cursor:hand;*/ + padding:1px 4px; + margin:0; +} + +.lightbluebutton { background-color:#4068AE; } +.bluebutton { background-color:#003794; } +.greybutton { background-color:#888888; } +.orange { color: #FF6600; } Index: lams_central/web/fckeditor/editor/plugins/equation/editor/images/add.gif =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/images/Attic/add.gif,v diff -u Binary files differ Index: lams_central/web/fckeditor/editor/plugins/equation/editor/images/copy.gif =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/images/Attic/copy.gif,v diff -u Binary files differ Index: lams_central/web/fckeditor/editor/plugins/equation/editor/images/pdf.jpg =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/images/Attic/pdf.jpg,v diff -u Binary files differ Index: lams_central/web/fckeditor/editor/plugins/equation/editor/images/spacer.gif =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/images/Attic/spacer.gif,v diff -u Binary files differ Index: lams_central/web/fckeditor/editor/plugins/equation/editor/images/sub.gif =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/images/Attic/sub.gif,v diff -u Binary files differ Index: lams_central/web/fckeditor/editor/plugins/equation/editor/images/wait.gif =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/images/Attic/wait.gif,v diff -u Binary files differ Index: lams_central/web/fckeditor/editor/plugins/equation/editor/js/_clipboard.swf =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/js/Attic/_clipboard.swf,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_central/web/fckeditor/editor/plugins/equation/editor/js/_clipboard.swf 21 Jan 2009 04:00:48 -0000 1.1 @@ -0,0 +1 @@ +CWSyx��``�g`�_����������{�P�u��̂��Ģ��Լ�� �����\���g��4&��'4��A&����4�� ,�$���w�� \ No newline at end of file Index: lams_central/web/fckeditor/editor/plugins/equation/editor/js/clipboard.js =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/js/Attic/clipboard.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_central/web/fckeditor/editor/plugins/equation/editor/js/clipboard.js 21 Jan 2009 04:00:48 -0000 1.1 @@ -0,0 +1,15 @@ +function copy(text2copy) { + if (window.clipboardData) { + window.clipboardData.setData("Text",text2copy); + } else { + var flashcopier = 'flashcopier'; + if(!document.getElementById(flashcopier)) { + var divholder = document.createElement('div'); + divholder.id = flashcopier; + document.body.appendChild(divholder); + } + document.getElementById(flashcopier).innerHTML = ''; + var divinfo = ''; + document.getElementById(flashcopier).innerHTML = divinfo; + } +} \ No newline at end of file Index: lams_central/web/fckeditor/editor/plugins/equation/editor/js/editor.js =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/js/Attic/editor.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_central/web/fckeditor/editor/plugins/equation/editor/js/editor.js 21 Jan 2009 04:00:48 -0000 1.1 @@ -0,0 +1,554 @@ +/* + Copyright CodeCogs 2007-2008 + Written by Will Bateman. + + GNU General Public License Agreement + Copyright (C) 2004-2008 CodeCogs, Zyba Ltd, Broadwood, Holford, TA5 1DU, England. + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by Free Software Foundation, + either version 3 of the License, or (at your option) any later version. + You must retain a copy of this licence in all copies. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + PARTICULAR PURPOSE. See the GNU General Public License for more details. + + See the GNU General Public License for more details. + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +var changed=false; +var orgtxt=''; +var EQUATION_ENGINE='http://codecogs.izyba.com'; + +// Clears the main editor window +function cleartext() { + var id=document.getElementById('latex_formula'); id.value = ""; id.focus(); + changed=false; + document.getElementById('copybutton').className='greybutton'; + document.getElementById('renderbutton').className='greybutton'; + +} + +function textchanged() { + var txt=getEquationStr(); + if(txt!=orgtxt) + { + orgtxt=txt; + document.getElementById('copybutton').className='lightbluebutton'; + document.getElementById('renderbutton').className='bluebutton'; + changed=true; + } +} + +function formatchanged() +{ + var action=false; + var format=document.getElementById('format'); + if(format) { var type=format.value; + switch(type) { + case 'gif' : action=false; break; + case 'png' : action=false; break; + case 'pdf' : action=true; break; + case 'swf' : action=true; break; + } + } + document.getElementById('dpi').disabled=action; + document.getElementById('dpi').readonly=action; + changed=true; + renderEqn(); +} + +// Tries to inserts text at the cursor position of text area +// wind = document <- when inserting text into the current equation editor box +// wind = window.opener.document <- when inserting text into a parent window box +function addText(wind, textbox, txt) +{ + myField = wind.getElementById(textbox); + // IE + if (wind.selection) { + myField.focus(); + sel = wind.selection.createRange(); + sel.text = txt; + } + // MOZILLA + else + { + var scrolly=myField.scrollTop; + if (myField.selectionStart || myField.selectionStart == '0') + { + var startPos = myField.selectionStart; + var endPos = myField.selectionEnd; + var cursorPos = startPos + txt.length; + myField.value = myField.value.substring(0, startPos) + txt + + myField.value.substring(endPos, myField.value.length); + pos = txt.length + endPos - startPos; + + myField.selectionStart = cursorPos; + myField.selectionEnd = cursorPos; + + myField.focus(); + myField.setSelectionRange(startPos + pos,startPos + pos); + } + else myField.value += txt; + + myField.scrollTop=scrolly; + } +} + +function insertText( txt, pos, inspos ) +{ + var insert_pos=(inspos==null)?pos:inspos; + textchanged() + + // pos = optional parameter defining where in inserted text to put the caret + // if undefined put at end of inserted text + // if pos=1000 then using style options and move to just before final } + // startPos = final position of caret in complete text + if (pos==1000) {pos=txt.length-1}; + if (pos==undefined) { txt+=' '; pos=txt.length;}; // always insert a space after + + // my textarea is called latex_formula + myField = document.getElementById('latex_formula'); + if (document.selection) { + // IE + myField.focus(); + var sel = document.selection.createRange(); + // find current caret position + var i = myField.value.length+1; + theCaret = sel.duplicate(); + while (theCaret.parentElement()==myField + && theCaret.move("character",1)==1) --i; + + // take account of line feeds + var startPos = i - myField.value.split('\n').length + 1 ; + + if ((txt.substring(1,5) == "left" || txt.substring(insert_pos-1,insert_pos)=='{') && sel.text.length) { + // allow highlighted text to be bracketed + if(txt.substring(1,5) == "left") ins_point=7; + else ins_point=insert_pos; + + if(inspos==null) pos = txt.length + sel.text.length + 1; + else if(inspos startPos) { + // allow highlighted text to be bracketed + + if(txt.substring(1,5) == "left") ins_point=7; + else ins_point=insert_pos; + + if(inspos==null) pos = txt.length + endPos - startPos + 1; + else if(inspos"; + img.onload = processEquationChange; + img.src=EQUATION_ENGINE+'/'+format+'.latex?' + val; + changed=false; + } break; + case 2 : // pdf + { + img.onload = ''; + img.src='http://www.codecogs.com/components/equationeditor/images/pdf.jpg'; + document.getElementById('download').src='http://www.codecogs.com/pdf.latex?'+val; + var div = document.getElementById('equationcomment'); + div.innerHTML = '
Click here if the PDF does not downloading.'; + } break; + case 3 : // swf + { + img.onload =''; + img.src='http://www.codecogs.com/components/equationeditor/images/spacer.gif'; + var div = document.getElementById('equationcomment'); + AC_FL_RunContent('codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','width', '600','height', '100','src', ('http://www.codecogs.com/swf.latex?'+val),'quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','align','top','scale','showall','wmode','window','devicefont','false','bgcolor','#ffffff','menu','true','allowFullScreen','true', +'movie', (EQUATION_ENGINE+'/swf.latex?'+val) ); + changed=false; + } break; + } + } + else + { + var div = document.getElementById('equationcomment'); + if(bracket<0) div.innerHTML = "
You have more closed '}' brackets than open '{' brackets"; + else div.innerHTML = "
You have more open '{' brackets than closed '}' brackets"; + } +} + + +/* We don't want to render with every keystroke, so we delay this part +This function will be called with each keystroke + - n is a tens of second unit +*/ +var auton=0; +function renderCountdown() +{ + if(auton>0) + { auton--; setTimeout('renderCountdown()', 100); } + else renderEqn(null); +} + + +function autorenderEqn(n) +{ + if(auton>0 && n>0) auton=n; + else { auton=n; renderCountdown(); } +} + +/* The following code adds a favorite to the favorite drop down. +To achieve this, we must update the users cookies */ + +function addfavorite(dropdown) +{ + text=document.getElementById('latex_formula').value; + var sel=document.getElementById(dropdown); + var num=sel.selectedIndex + if(num==0 || !confirm("Click Yes to replace the current equation or 'Cancel' to add a new equation")) + { + var name = prompt('Please enter a short name for this equation:', '') + if(name==null || name=='') name=text.substr(0,15); + /* Add to favorite */ + var j=sel.length; + sel.length=j+1; + sel.options[j].text=name; + sel.options[j].value=text; + sel.options[j].title=text; + /* Make sure cookie name is unique to website */ + document.cookie = "eq_"+escape(name.replace(/\+/g,"+").replace(/\s/g,"&space;"))+"="+escape(text.replace(/\+/g,"+"))+"; path=/"; + } + else + { + sel.options[num].value=text; + sel.options[num].title=text; + /* Make sure cookie name is unique to website */ + document.cookie = "eq_"+escape(name.replace(/\+/g,"+").replace(/\s/g,"&space;"))+"="+escape(text.replace(/\+/g,"+"))+"; path=/"; + } +} + +function deletefavorite(dropdown) +{ + var sel=document.getElementById(dropdown); + var num=sel.selectedIndex + if(num>0) + { + name=sel.options[num].text; + + var mydate = new Date(); + mydate.setTime(mydate.getTime() - 1); + document.cookie = "eq_"+escape(name.replace(/\+/g,"+").replace(/\s/g,"&space;"))+"=; expires="+mydate.toGMTString()+"; path=/"; + sel.options[num]=null; + } +} + + +/* Help to generate a Matrix */ +// generate a set of aligned equations - thornahawk +// isNumbered: switches between numbered and not numbered equations +function makeEquationsMatrix(type, isNumbered, isConditional) +{ + if (isNumbered==undefined) isNumbered=false; + if (isConditional==undefined) isNumbered=false; + + var eqns="\\begin{"+type+((isNumbered)?"":"*")+"}"; + var eqi="\n &"+((isNumbered)?" ":"= ")+((isConditional)?"\\text{ if } x= ":""); + var eqEnd="\n\\end{"+type+((isNumbered)?"":"*")+"}"; + var i=0; + + var dim = prompt('Enter the number of lines:', ''); + + if (dim != '' && dim != null) { + n=parseInt(dim); + if (!isNaN(n)) { + for (i=1;i<=n-1;i++) eqns=eqns+(eqi+"\\\\ "); + eqns=(eqns+eqi)+eqEnd; + insertText(eqns,type.length+((isNumbered)?0:1)+9); + } + } +} + +// generate an array of specified dimensions - thornahawk +// type: sets the type of array, e.g. pmatrix +function makeArrayMatrix( type, start, end ) +{ + var matr=start+'\\begin{'+type+'matrix}'; + var row="\n"; + var mend="\n\\end{"+type+"matrix}"+end; + var i=0; + var dim = prompt('Enter the array dimensions separated by a comma (e.g. "2,3" for 2 rows and 3 columns):', '') + + if (dim!='' && dim!=null) + { + dim=dim.split(','); + m=parseInt(dim[0]); + n=parseInt(dim[1]); + + if (!isNaN(m) && !isNaN(n)) + { + for (i=2;i<=n;i++) row=row+' & '; + for (i=1;i<=m-1;i++) matr=matr+row+'\\\\ '; + + matr=matr+row+mend; + insertText(matr,type.length+start.length+15); + } + } +} + +function hover(elm, e) +{ + div=document.getElementById('hover'); + div.innerHTML=''; + + if(document.all) { div.style.top = (event.clientY-10)+'px'; div.style.left = (event.clientX+20)+'px'; } + else { if(!e) var e=window.event; div.style.top = (e.pageY-10)+'px'; div.style.left = (e.pageX+20)+'px'; } + div.style.display='block'; + elm.onmouseout= function() { document.getElementById('hover').style.display='none';} +} + + +/* This script and many more are available free online at +The JavaScript Source!! http://javascript.internet.com +Created by: Turnea Iulian :: http://www.eurografic.ro */ +function iObject() { this.i; return this; } + +var myObject=new iObject(); +myObject.i=0; +var myObject2=new iObject(); +myObject2.i=0; +store_text=new Array(); + +//store_text[0] store initial textarea value +store_text[0]=""; + +function countclik(tag) { + var x=tag.value; + if(myObject.i==0 || store_text[myObject.i]!=x) + { + myObject.i++; + var y=myObject.i; + store_text[y]=x; + } + myObject2.i=0; + document.getElementById('redobutton').src="http://www.codecogs.com/images/buttons/redo-x.gif"; + document.getElementById('undobutton').src="http://www.codecogs.com/images/buttons/undo.gif"; +} + +function undo(box) { + tag=document.getElementById(box); + if ((myObject2.i)<(myObject.i)) { + myObject2.i++; + if(myObject2.i==myObject.i) { + document.getElementById('undobutton').src="http://www.codecogs.com/images/buttons/undo-x.gif"; } + document.getElementById('redobutton').src="http://www.codecogs.com/images/buttons/redo.gif"; + } else { + alert("Finish Undo Action"); + } + var z=store_text.length; + z=z-myObject2.i; + if (store_text[z]) { tag.value=store_text[z]; } + else { tag.value=store_text[0]; } + tag.focus(); +} + +function redo(box) { + tag=document.getElementById(box); + if((myObject2.i)>1) { + myObject2.i--; + if(myObject2.i==1){ + document.getElementById('redobutton').src="http://www.codecogs.com/images/buttons/redo-x.gif"; } + document.getElementById('undobutton').src="http://www.codecogs.com/images/buttons/undo.gif"; + } else { + alert("Finish Redo Action"); + } + var z=store_text.length; + z=z-myObject2.i; + if (store_text[z]) { tag.value=store_text[z]; } + else { tag.value=store_text[0]; } + tag.focus(); +} + + +function updateOpener(target, type) +{ + if(target!='') + { // *** Traditional mode with plane HTML text box *** + var text; + if(type=='phpBB') + { // Create LaTeX string for insertion into phpBB forum + text=getEquationStr(); + text = '[tex]' + text + '[/tex]\n'; + } + else if(type=='html') + { // Create tag for insertion into html + text=getEquationStr(); + text = ''; + } + else + { // Create LaTeX string for insertion into CodeCogs of DOxygen C/C++ markup language + // Note size and + text=document.getElementById('latex_formula').value; + var size = document.getElementById('fontsize'); + if(size && size.selectedIndex!=2) + text=size.options[size.selectedIndex].value+' '+text; + + if(document.getElementById('inline').checked) + { + if(!document.getElementById('compressed').checked) text='\\displaystyle '+text; + text = '$' + text + '$ '; + } + else + { + if(document.getElementById('compressed').checked) text='\\inline '+text; + text = '\\[' + text + '\\]\n'; + } + } + addText(window.opener.document,target,text); + } + else + { // *** Advanced mode with FCKEditor *** + var text=document.getElementById('latex_formula').value; + var size = document.getElementById('fontsize'); + if(size && size.selectedIndex!=2) + text=size.options[size.selectedIndex].value+' '+text; + + if (text.length == 0) { + alert(FCKLang.EquationErrNoEqn) ; + return false ; + } + + if(document.getElementById('inline').checked) + { + if(!document.getElementById('compressed').checked) + text='\\displaystyle '+text; + text = '\\f$' + text + '\\f$ '; + } + else + { + if(document.getElementById('compressed').checked) + text='\\inline '+text; + text = '\\f[' + text + '\\f]\n'; + } + + if ( eSelected && eSelected._fckequation == text ) + return true ; + + // inserted this so it puts the whole thing in one line (ernieg) + text=text.replace(/(\r\n|[\r\n])/g, " "); + FCKEquation.Add(text); + } + return true ; +} \ No newline at end of file Index: lams_central/web/fckeditor/editor/plugins/equation/editor/js/eq_fck.js =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/js/Attic/eq_fck.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_central/web/fckeditor/editor/plugins/equation/editor/js/eq_fck.js 21 Jan 2009 04:00:48 -0000 1.1 @@ -0,0 +1,53 @@ +/* + Copyright CodeCogs 2007-2008 + Written by Will Bateman. + + GNU General Public License Agreement + Copyright (C) 2004-2008 CodeCogs, Zyba Ltd, Broadwood, Holford, TA5 1DU, England. + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by Free Software Foundation, + either version 3 of the License, or (at your option) any later version. + You must retain a copy of this licence in all copies. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + PARTICULAR PURPOSE. See the GNU General Public License for more details. + + See the GNU General Public License for more details. + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +// --- FCKEditor Integration ---- +var oEditor = window.opener; +var FCKEquation=null; +var eSelected=null; + +// Loads the equations from the fckeditor, or create a default equations for an example +function LoadSelected() +{ + // Look for fckeditor + if(oEditor && typeof(oEditor.FCKEquation)!='undefined') + { + FCKEquation = oEditor.FCKEquation; + if(FCKEquation) + eSelected = oEditor.FCKSelection.GetSelectedElement(); + + if ( eSelected && eSelected.tagName == 'IMG' && eSelected._fckequation ) { + var comm = unescape( eSelected._fckequation ); + var parts = comm.match( /\\f([\[\$])(.*?)\\f[\]\$]/ ); + + document.getElementById('latex_formula').value = parts[2]; + + if(parts[1]=='[') + document.getElementById('eqstyle2').checked=true; + else + document.getElementById('eqstyle1').checked=true; + renderEqn(null); + } + else { + // Put any default equations in the line below... + document.getElementById('latex_formula').value = ''; + eSelected == null ; + } + } +} \ No newline at end of file Index: lams_central/web/fckeditor/editor/plugins/equation/editor/js/eq_flash.js =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/js/Attic/eq_flash.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_central/web/fckeditor/editor/plugins/equation/editor/js/eq_flash.js 21 Jan 2009 04:00:48 -0000 1.1 @@ -0,0 +1,298 @@ +//v1.7 +// Flash Player Version Detection +// Detect Client Browser type +// Copyright 2005-2007 Adobe Systems Incorporated. All rights reserved. +var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; +var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; +var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; + +function ControlVersion() +{ + var version; + var axo; + var e; + + // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry + + try { + // version will be set for 7.X or greater players + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); + version = axo.GetVariable("$version"); + } catch (e) { + } + + if (!version) + { + try { + // version will be set for 6.X players only + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); + + // installed player is some revision of 6.0 + // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29, + // so we have to be careful. + + // default to the first public version + version = "WIN 6,0,21,0"; + + // throws if AllowScripAccess does not exist (introduced in 6.0r47) + axo.AllowScriptAccess = "always"; + + // safe to call for 6.0r47 or greater + version = axo.GetVariable("$version"); + + } catch (e) { + } + } + + if (!version) + { + try { + // version will be set for 4.X or 5.X player + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); + version = axo.GetVariable("$version"); + } catch (e) { + } + } + + if (!version) + { + try { + // version will be set for 3.X player + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); + version = "WIN 3,0,18,0"; + } catch (e) { + } + } + + if (!version) + { + try { + // version will be set for 2.X player + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); + version = "WIN 2,0,0,11"; + } catch (e) { + version = -1; + } + } + + return version; +} + +// JavaScript helper required to detect Flash Player PlugIn version information +function GetSwfVer(){ + // NS/Opera version >= 3 check for Flash plugin in plugin array + var flashVer = -1; + + if (navigator.plugins != null && navigator.plugins.length > 0) { + if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) { + var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; + var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description; + var descArray = flashDescription.split(" "); + var tempArrayMajor = descArray[2].split("."); + var versionMajor = tempArrayMajor[0]; + var versionMinor = tempArrayMajor[1]; + var versionRevision = descArray[3]; + if (versionRevision == "") { + versionRevision = descArray[4]; + } + if (versionRevision[0] == "d") { + versionRevision = versionRevision.substring(1); + } else if (versionRevision[0] == "r") { + versionRevision = versionRevision.substring(1); + if (versionRevision.indexOf("d") > 0) { + versionRevision = versionRevision.substring(0, versionRevision.indexOf("d")); + } + } + var flashVer = versionMajor + "." + versionMinor + "." + versionRevision; + } + } + // MSN/WebTV 2.6 supports Flash 4 + else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4; + // WebTV 2.5 supports Flash 3 + else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3; + // older WebTV supports Flash 2 + else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2; + else if ( isIE && isWin && !isOpera ) { + flashVer = ControlVersion(); + } + return flashVer; +} + +// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available +function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) +{ + versionStr = GetSwfVer(); + if (versionStr == -1 ) { + return false; + } else if (versionStr != 0) { + if(isIE && isWin && !isOpera) { + // Given "WIN 2,0,0,11" + tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"] + tempString = tempArray[1]; // "2,0,0,11" + versionArray = tempString.split(","); // ['2', '0', '0', '11'] + } else { + versionArray = versionStr.split("."); + } + var versionMajor = versionArray[0]; + var versionMinor = versionArray[1]; + var versionRevision = versionArray[2]; + + // is the major.revision >= requested major.revision AND the minor version >= requested minor + if (versionMajor > parseFloat(reqMajorVer)) { + return true; + } else if (versionMajor == parseFloat(reqMajorVer)) { + if (versionMinor > parseFloat(reqMinorVer)) + return true; + else if (versionMinor == parseFloat(reqMinorVer)) { + if (versionRevision >= parseFloat(reqRevision)) + return true; + } + } + return false; + } +} + +function AC_AddExtension(src, ext) +{ + /*if (src.indexOf('?') != -1) + return src.replace(/\?/, ext+'?'); + else + return src + ext;*/ + return src; +} + +function AC_Generateobj(objAttrs, params, embedAttrs) +{ + var str = ''; + // if (isIE && isWin && !isOpera) + /* { + str += ' '; + } + str += ''; + } + else*/ + { + str += '= 3 check for Flash plugin in plugin array + var flashVer = -1; + + if (navigator.plugins != null && navigator.plugins.length > 0) { + if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) { + var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; + var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description; + var descArray = flashDescription.split(" "); + var tempArrayMajor = descArray[2].split("."); + var versionMajor = tempArrayMajor[0]; + var versionMinor = tempArrayMajor[1]; + var versionRevision = descArray[3]; + if (versionRevision == "") { + versionRevision = descArray[4]; + } + if (versionRevision[0] == "d") { + versionRevision = versionRevision.substring(1); + } else if (versionRevision[0] == "r") { + versionRevision = versionRevision.substring(1); + if (versionRevision.indexOf("d") > 0) { + versionRevision = versionRevision.substring(0, versionRevision.indexOf("d")); + } + } + var flashVer = versionMajor + "." + versionMinor + "." + versionRevision; + } + } + // MSN/WebTV 2.6 supports Flash 4 + else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4; + // WebTV 2.5 supports Flash 3 + else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3; + // older WebTV supports Flash 2 + else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2; + else if ( isIE && isWin && !isOpera ) { + flashVer = ControlVersion(); + } + return flashVer; +} + +// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available +function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) +{ + versionStr = GetSwfVer(); + if (versionStr == -1 ) { + return false; + } else if (versionStr != 0) { + if(isIE && isWin && !isOpera) { + // Given "WIN 2,0,0,11" + tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"] + tempString = tempArray[1]; // "2,0,0,11" + versionArray = tempString.split(","); // ['2', '0', '0', '11'] + } else { + versionArray = versionStr.split("."); + } + var versionMajor = versionArray[0]; + var versionMinor = versionArray[1]; + var versionRevision = versionArray[2]; + + // is the major.revision >= requested major.revision AND the minor version >= requested minor + if (versionMajor > parseFloat(reqMajorVer)) { + return true; + } else if (versionMajor == parseFloat(reqMajorVer)) { + if (versionMinor > parseFloat(reqMinorVer)) + return true; + else if (versionMinor == parseFloat(reqMinorVer)) { + if (versionRevision >= parseFloat(reqRevision)) + return true; + } + } + return false; + } +} + +function AC_AddExtension(src, ext) +{ + if (src.indexOf('?') != -1) + return src.replace(/\?/, ext+'?'); + else + return src + ext; +} + +function AC_Generateobj(objAttrs, params, embedAttrs) +{ + var str = ''; + if (isIE && isWin && !isOpera) + { + str += ' '; + } + str += ''; + } + else + { + str += '\hat{a}'); \ No newline at end of file Index: lams_central/web/fckeditor/editor/plugins/equation/editor/panels/arrows_panel.gif =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/panels/Attic/arrows_panel.gif,v diff -u Binary files differ Index: lams_central/web/fckeditor/editor/plugins/equation/editor/panels/brackets_panel.gif =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/panels/Attic/brackets_panel.gif,v diff -u Binary files differ Index: lams_central/web/fckeditor/editor/plugins/equation/editor/panels/greekletters_panel.gif =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/panels/Attic/greekletters_panel.gif,v diff -u Binary files differ Index: lams_central/web/fckeditor/editor/plugins/equation/editor/panels/matrix_panel.gif =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/panels/Attic/matrix_panel.gif,v diff -u Binary files differ Index: lams_central/web/fckeditor/editor/plugins/equation/editor/panels/operators_panel.gif =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/panels/Attic/operators_panel.gif,v diff -u Binary files differ Index: lams_central/web/fckeditor/editor/plugins/equation/editor/panels/relations_panel.gif =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/panels/Attic/relations_panel.gif,v diff -u Binary files differ Index: lams_central/web/fckeditor/editor/plugins/equation/editor/panels/design/designs.psd.zip =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/editor/panels/design/Attic/designs.psd.zip,v diff -u Binary files differ Index: lams_central/web/fckeditor/editor/plugins/equation/lang/en.js =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/fckeditor/editor/plugins/equation/lang/Attic/en.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_central/web/fckeditor/editor/plugins/equation/lang/en.js 21 Jan 2009 04:00:48 -0000 1.1 @@ -0,0 +1,4 @@ +FCKLang.EquationBtn = 'Insert/Edit Equation' ; +FCKLang.EquationDlgTitle = 'Equation Properties' ; +FCKLang.EquationDlgName = 'Equation Editor' ; +FCKLang.EquationErrNoEqn = 'Please enter an equation first' ; Index: lams_central/web/includes/javascript/fckconfig_custom.js =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/Attic/fckconfig_custom.js,v diff -u -r1.14 -r1.15 --- lams_central/web/includes/javascript/fckconfig_custom.js 16 Oct 2008 03:33:22 -0000 1.14 +++ lams_central/web/includes/javascript/fckconfig_custom.js 21 Jan 2009 04:04:37 -0000 1.15 @@ -1,5 +1,5 @@ FCKConfig.ToolbarSets["Default"] = [ - ['Source','-','FitWindow', 'Preview','PasteWord','Undo','Redo','Bold','Italic','Underline', '-','Subscript','Superscript','OrderedList','UnorderedList','-','Outdent','Indent','JustifyLeft','JustifyCenter','JustifyRight','JustifyFull','TextColor','BGColor'], + ['Source','-','FitWindow', 'Preview','PasteWord','Undo','Redo','Bold','Italic','Underline', '-','Subscript','Superscript','OrderedList','UnorderedList','-','Outdent','Indent','JustifyLeft','JustifyCenter','JustifyRight','JustifyFull','TextColor','BGColor','Equation'], ['Image','Link','Table','Rule','Smiley','SpecialChar','Templates','FontFormat','FontName','FontSize','About'] ] ; @@ -37,3 +37,4 @@ FCKConfig.FontFormats = 'div;h1;h2;h3;h4;h5;h6;pre;address;p' ; FCKConfig.EnterMode = 'div' ; FCKConfig.Plugins.Add('wikilink', 'en', FCKConfig.BasePath + '../../tool/lawiki10/'); +FCKConfig.Plugins.Add('equation', 'en');