Posts Tagged ‘Lectora’

Enable and fix Lectora titles for the Opera browser

Friday, June 17th, 2011

Problem: If you publish a title with Lectora, and try to view it from Opera, instead of the title you see an error message

Your browser does not support dynamic html. Please download a current version of either Microsoft'" DESIGNTIMESP=18189>Microsoft Internet Explorer or Mozilla'" DESIGNTIMESP=18192>Mozilla Firefox and try visiting our site again. Thank You.

Solution: You have to modify trivantis.js in line 353 and line 355. The modifications are displayed in bold

this.ns = (name=="ns" && this.v>=4)||(navigator.userAgent.indexOf("Opera")!=-1)
this.ns4 = (this.ns && this.v==4)
this.ns5 = (this.ns && this.v==5)||(navigator.userAgent.indexOf("Opera")!=-1)

IMPORTANT: WordPress fucks up the quotation marks above, fix them by hand!!!

This tells Lectora's code to treat Opera like Netscape Navigator and its derivates. For the title we are developing for the WHO (ICF eLearning tool) it works flawlessly.

This fix is taken from this Lectora forum message, posted by ssneg.

(ssneg also explains why it is not possible to override this.min and set it to true – because Lectora only includes code for IE or NS to display the title contents, like buttons, later on. Thus we need for Opera to "pretend" that it is Navigator. The code works.)

Do you know any other browsers incompatible with Lectora? Please post a comment, and we might find a solution :-)!

 

Fix for weird bug

Sunday, April 3rd, 2011

Lectora inserts anchors (<A name=""> elements) which sometimes can break things!

I have programmed exercises with a sliding animation from "page" to "page" of exercises using the Scrollable from JQuery Tools. It would work fine in an older FireFox, but broke apparently in the newest version, it newer worked in Chrome, but it works in IE. The exercises would jump to the last page, skipping over everything in between.

After one hour of debugging I found out that an additional <A></A> element had to be inserted in each "page" of the exercises. (I do it programmaticaly using PHP.) Now all items show up … with an additional item (depending on the browser).

This additional item is an anchor inserted by Lectora. There's no use putting code to take it out again to run on page load, as Lectora's code seems to run later. You have to run your code as soon, as the user triggers an action, just at the beginning of it to clean up.

//fixing Lectora interfering with our code …
$("#exercise > .items > a").remove();

A simple fix for a complex problem … Lectora does require a lot of workarounds.

Lectoras external HTML object and z-index

Sunday, February 20th, 2011

Given the limited flexibility of Lectora, in some cases you need to include custom scripted HTML objects.

For instance you want to build an overlay for a login dialog, which would communicate directly with the server using AJAX.

After positioning your external HTML object on the page and building the HTML you want to include (by i.e. a PHP "include" call), sometimes you will find Lectora is putting other things on top of your HTML object's contents.

The first possibility to fix this would be modifying Lectora's "Layering" option of your object: "Bring to Front".

The second possibility comes in handy, if you do not want to modify the Lectora project itself: on-the fly z-index – updating.

I use the JS library JQuery to efficiently work on the DOM across browsers. Using it, you can set the z-index during runtime (i.e. reacting to a mouseclick on an icon):

$('#object-name').css('z-index','1000');

You can find out the name of the DIV Lectora creates for your external HTML object using Firebug, or looking up the object name property in Lectora (double click your object to see the settings dialogue).

Creating DIVs inside your Lectora object and setting their z-indices to higher values, i.e. by CSS, does not work. You need to alter the z-index of the wrapper DIV provided by Lectora. It is created during run-time using this code:

object-name = new ObjInline('object-name',null,0,580,900,40,1,15,null,'div')
object-name.build()

The Lectora code sets the z-index! Thus, your z-index from the CSS would be ignored, and you need to update it during runtime, as I have described above.

Adding content to the head of Lectora HTML output

Sunday, May 23rd, 2010

There's the possibility to add an "external HTML object". If you choose "header scripting", your content would be added to the <script> section of Lectora in the header. In most cases that's not what you want to achieve. There's another strange option "Top of file scripting" which simply inserts your content just before the <!DOCTYPE> tag. The only use I can see for this is for PHP scripting which needs to be done before any output was sent to the browser (i.e. header modification).

What you want to choose to include arbitrary content to the <HEAD> section of Lectora generated HTML documents is the "META Tag" option. Unfortunately, this does not allow to include external .txt files, so you have to paste your code in Lectora's input window. (You would have needed to update the .txt file anyways, as Lectora stays with the initial .txt file version instead of updating it from the hard disk every time. That way it's not really a big loss that you can't use .txt files.)

And there IS a way to include a file's contents in the header. Just drop a PHP file somewhere on your server and include it using the following as a "meta tag":

<?php include('your/path/to/header.php');?>

Lectora and unterminated string literals

Sunday, February 21st, 2010

Sometimes Lectora renders the HTML, and you end up with broken pages. You start trying to disable things, sometimes it works, sometimes it doesn't.

My advice: first use Firefox' error console to find out what the error is about. Sometimes it's an "unterminated string literal":

VarAktuellerKapitelname.set( 'El modelo biopsicosocial integrativo de la CIF

' )

You can solve this problem by patching the file and re-copying it over the output when rendering. (Of course you have to keep track of whether the page gets updated …)

Here's the correct version of this line of code:

VarAktuellerKapitelname.set( 'El modelo biopsicosocial integrativo de la CIF' )

Easy, huh? The real challenge lies in tracking the little files … Well, why don't you make it our problem? We'll solve Lectora problems for you – ask for our competitive rates!