Moodle 2.5 - Ext JS reference in a course

Moodle 2.5 - Ext JS reference in a course

by Phil Gillis -
Number of replies: 3

Hello,

In 1.9 our teachers were allowed to use external referenced javascript files in their HTML resources in a course. However, in 2.5 they seem to be ignored or "Stripped out". I wasn't the 1.9 admin so I am not sure if or what provisions were made for this to work and the Edit Profile-Use Standard Forms method I see in older posts doesn't work. 

Can someone tell me how to enabled a simliar script tag to be used inside HTML resources in a course in moodle 2.5 so a teacher can paste and use these resources?

<script id="bblcmt" language="JavaScript" type="text/javascript"src="http://www.bubblecomment.com/embed_auto_03.js?userid=xxxx&vid=xxxx"></script>

 

Average of ratings: -
In reply to Phil Gillis

Re: Moodle 2.5 - Ext JS reference in a course

by Richard Bakos -

Two possible methods I know of:

  • The teacher goes to My Profile Settings -> Edit Profile, then change the field "When editing text" to "Standard web forms". This will turn off the WYSIWYG editor and prevent anything from being stripped out.
  • Or you can use this method when in HTML view using the WYSIWYG editor: 
    <script type="text/javascript" src="http://www.bubblecomment.com/embed_auto_03.js?userid=xxxx&vid=xxxx">// <![CDATA[// ]]></script>

    This method requires that you use the "Purge all caches" function found in Administration -> System Administration -> Development, otherwise the src will be shows as "about:blank".

Hope that helps... 

In reply to Richard Bakos

Re: Moodle 2.5 - Ext JS reference in a course

by Phil Gillis -

Thank you Richard.

If you go the profile route to standard web forms, which option would you choose in the content area dropdown (HTML format,Moodle auto-format, Plain text format, markdown format)

An instructor won't be able to clear the caches I believe. I have tried the ![CDATA approach and even with clearing cache not had any luck. This has been done with the wysiwyg editor, switching to source view and pasting in snippet.

In reply to Phil Gillis

Re: Moodle 2.5 - Ext JS reference in a course

by Richard Bakos -

Hello Phil,

Are you inspecting the document to see if the script is loaded or are you assuming the script isn't loading because the functionality of the script isn't working? 

There is one thing I forgot to mention. You should enable trusted content in your site policies, System Administration -> Security -> Site policies and check "Enable trusted content". Even still, your script isn't working... 

I just loaded your script into my dev environment, and while the script get loaded, it throws this error:

Screen Cap

I think it may the nature of the script file trying to write to the DOM by loading other external files... And Moodle might not like that... 

In any case, as you already know and mentioned, teachers can't purge the caches and it's impractical to call upon an admin every time a script is added anyways... 

So going with the first option is your safest bet... You want to use HTML format... Even still, with that particular type of script, it's going to throw the error... You may want to try including the actual script code of this file into the editor... 

Hope that helps...