Hi, I just upgraded form 4.7 to 5.0 and for the most part the site is working.

I'm having trouble with two areas: Collapsiblocks, and tinymce. For Collapsoblocks, I'm having this trouble. I'm working in BlueMarine.

I'm getting "Drupal is not defined errors in my FF2.0 Error console. I'm trying this url: http://community.mahasiddhas.org/node/add/story

Below is the code it links to. Any ideas? Anybody run into this before? I cleared my cache tables (deleted all the rows in them) is there any other place I should scrape barnacles off?

This line is strange:

<style type="text/css" media="all">@import "/sites/all/modules/jstools/jscalendar/jscalendar.css";</style>
<style type="text/css" media="all">@import "/0";</style>                       <------------------------------------------ Why the /0?
<style type="text/css" media="all">@import "/themes/bluemarine/style.css";</style>

"Drupal is not defined" jstools, activemenu.js, collapsiblock.js, upload.js, jscalendar.js, autocomplete.js, smapsmap.compressed.js, and like 37. The "Drupal.extend"

Full code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<head>
  <title>Submit Story | MahaSiddha Dharma Community</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <style type="text/css" media="all">@import "/modules/forum/forum.css";</style>
<style type="text/css" media="all">@import "/modules/node/node.css";</style>
<style type="text/css" media="all">@import "/modules/poll/poll.css";</style>
<style type="text/css" media="all">@import "/modules/system/defaults.css";</style>

<style type="text/css" media="all">@import "/modules/system/system.css";</style>
<style type="text/css" media="all">@import "/modules/user/user.css";</style>
<style type="text/css" media="all">@import "/sites/all/modules/gallery/drupal_g2.css";</style>
<style type="text/css" media="all">@import "/sites/all/modules/jstools/activemenu/activemenu.css";</style>
<style type="text/css" media="all">@import "/sites/all/modules/jstools/collapsiblock/collapsiblock.css";</style>
<style type="text/css" media="all">@import "/sites/all/modules/logintoboggan/logintoboggan.css";</style>
<style type="text/css" media="all">@import "/sites/all/modules/jstools/jscalendar/jscalendar.css";</style>
<style type="text/css" media="all">@import "/0";</style>
<style type="text/css" media="all">@import "/themes/bluemarine/style.css";</style>

  <script type="text/javascript" src="/misc/jquery.js"></script>
<script type="text/javascript" src="/misc/drupal.js"></script>
<script type="text/javascript" src="/sites/all/modules/jstools/jstools.js"></script>
<script type="text/javascript" src="/sites/all/modules/jstools/activemenu/activemenu.js"></script>
<script type="text/javascript" src="/sites/all/modules/jstools/collapsiblock/collapsiblock.js"></script>
<script type="text/javascript" src="/misc/progress.js"></script>
<script type="text/javascript" src="/misc/upload.js"></script>
<script type="text/javascript" src="/sites/all/modules/tinymce/includes/jscripts/tiny_mce/tiny_mce.js"></script>

<script type="text/javascript" src="/sites/all/modules/tinymce/themes/tinymce_compact.js"></script>
<script type="text/javascript" src="/sites/all/modules/jstools/jscalendar/lib/calendar_stripped.js"></script>
<script type="text/javascript" src="/sites/all/modules/jstools/jscalendar/lib/calendar-setup_stripped.js"></script>
<script type="text/javascript" src="/sites/all/modules/jstools/jscalendar/lib/lang/calendar-en.js"></script>
<script type="text/javascript" src="/sites/all/modules/jstools/jscalendar/jscalendar.js"></script>
<script type="text/javascript" src="/misc/autocomplete.js"></script>
<script type="text/javascript" src="/misc/collapse.js"></script>
<script type="text/javascript" src="/misc/textarea.js"></script>
<script type="text/javascript" src="/sites/all/modules/spamspan/spamspan.compressed.js"></script>

<script type="text/javascript">Drupal.extend({ settings: { "jstools": { "cleanurls": true, "basePath": "/" }, "collapsiblock": { "block-event-0": "2", "block-forum-0": "3", "block-block-2": "2", "block-blog-0": "3" }, "spamspan": { "m": "spamspan", "u": "u", "d": "d", "t": "t" } } });</script>
<script type="text/javascript">
var now = new Date();
var offset = now.getTimezoneOffset();
if (!(offset == 480)) {document.write('\x3clink  rel="stylesheet" type="text/css" href="/autotimezone/' + offset + '"/\x3e')};</script>
<script type="text/javascript">
    if ('undefined' != typeof(window.tinyMCE)) {
      for (var i=0; i<tinyMCE.configs.length; i++) {
        tinyMCE.configs[i]['elements'] = 'edit-body,edit-comment';
      }
    }
  </script>
  <script type="text/javascript"> </script>

Comments

MichaelCole’s picture

I get these Druapl is not defined errors on every page of the site...

MichaelCole’s picture

Adding this to my settings.php fixed it:

$base_url = 'http://community.mahasiddhas.org';

sjcctan’s picture

Hello,

I have uncommented the line $base_url = 'http://www.dgflow.com'. But the site still has this error message:

Line: 3
Char: 1
Error: 'Drupal' is undefined
Code: 0
URL: http://www.dgflow.com

There is no such error when you visit the site. But when you login as admin, the error will appear. Anyone any idea?

Thank you.

satori1984’s picture

+1

belbo’s picture

Replace in sites\all\modules\tinymce\tinymce.module

drupal_add_js(drupal_get_path('module', 'tinymce') . '/includes/jscripts/tiny_mce/tiny_mce.js');

with

drupal_add_js(drupal_get_path('module', 'tinymce') . '/includes/tinymce/jscripts/tiny_mce/tiny_mce.js');

sjcctan’s picture

Hello,

I have done this too. But the site still has this error message:

Line: 3
Char: 1
Error: 'Drupal' is undefined
Code: 0
URL: http://www.dgflow.com

There is no such error when you visit the site. But when you login as admin, the error will appear. Anyone any idea?

Thank you.

cosmicdreams’s picture

I am getting this error too. I not only get it on regular pages but also the update.php page. This prohibits me from seeing what is going to be updated. It also kills the javascripting in the regular pages.

cosmicdreams’s picture

Applying the fix suggested above has fixed my javascripting for the update.php page. But not for my home page or my theme. I'm going to research how to convert a 4.7 theme for 5.0 but if anyone already has that link...please let me know where it is.

tjharman’s picture

I managed to fix this problem.

My site was being configured from /sites/default

I moved the "default" folder to "my.site.url.path" and this fixed the problem.

I hope this helps you.

lightweight’s picture

In some cases, as I found with the 4.7 nice_menus.module, trying to import javascript using the IE escape syntax ( i.e. [if lte IE 6]) and the drupal_set_html_head rather than drupal_add_js will cause this error. Now I'm trying to figure out an efficient way of conditionally including JS file only for IE6 or lesser (can they get any lesser?!) short of importing a full browser detection script on the PHP side...

winston’s picture

  • Just upgraded 4.7 site to 5.0 (haven't gone to 5.1 yet)
  • Only getting this type of error when trying to edit a node (any type of node)
  • I disabled all contrib modules I was using (not many) and still same problem
  • I am only getting this problem when using my website with IE 6 and trying to edit a node
  • Firefox (running on linux), and IE 7 seem to be fine. Haven't been able to test on Firefox on Windows yet.
  • Haven't had a chance to try the baseurl option. Also haven't had a chance to try any other debugging. But I'm thinking if baseurl (which is an optional setting) is required to make this problem go away this must surely be a bug of some sort. Any thoughts on that?

    - Peter

    winston’s picture

    That worked for me in getting rid of the "Drupal is not defined" error and I am now able to successfully edit pages on IE6 using TinyMCE.

    I have another Javascript error when editing nodes, but as far as I can tell it isn't interfering with the page functionality.

    - Peter

    snoble’s picture

    I was getting the same error until I cleared my browser cache. drupal.js changed but its name did not. I'm not sure of a good solution to fix this problem with other viewers of your site.

    Cheers,
    Steven

    sgware’s picture

    The problem for me was that my theme included $scripts toward the bottom of the page, below the footer where (in my case) FCKEditor was adding in the Drupal.jsEnabled function.

    Fix: Make sure your theme prints $scripts somewhere within the tags.

    Mike Sances’s picture

    This solution worked for me. I just had to put $scripts in my page.tpl.php. (Actually just had to copy from Garland theme's page.tpl.php file and paste it into my modified pushbutton file.)

    vascopj’s picture

    This also worked for me - google analytics was using it at the bottom of the html but $scripts wasn't in my template.

    Cheers
    Sean

    eriktoyra’s picture

    This is true that $script should be printed at the bottom of page.tpl.php, but one have to make sure that $closure is printed at the very last line before the closing . I had accidently switched $scripts and $closure in my theme and I got the "Drupal is not defined" error thanks to this. Make sure your page.tpl.php file ens like this and it should work.

      <?php print $scripts ?>
      <?php print $closure ?>
      </body>
    </html>
    
    asak’s picture

    I don't user any text editors and don't user collapsiblock. I use the latest drupal 5 version and all modules are up to date. I've installed the jQuery update (and configured it correctly...). I've umarked that line mentioned in settings.php and even tried to change to the name of the folder. i checked and $scripts is where it should be in page.tpl.php.

    What i'm suspecting is:
    1. I'm running my site from a sub-domain (http://clients.whatever.com) - I remember some talk about problems with sub-domains but don't remember any of them to be related to .js problems

    2. Something to do with Fieldset Menus. I'm not sure about this - but i think it had something to do with it....

    No more ideas... anyone?

    vlooivlerke’s picture

    I have 3 working drupal sites and all 3 suddenly gave this problem, on the same day. All 3 sites are hosted on the same server. I did a jquery update on one site, but worked fine for a day, then this problem started on all the sites.

    So this could not be a jquery_update problem, but more a temp directory problem from the host.
    Have a look at this: http://drupal.org/node/200926 comment #2.

    This solution did not work for me, but I never had this problem before. My host say they did not upgrade any php, mysql or apache.

    Now i am unable to use any upload features on any of my production sites. (from that host)

    Site 1 and 2 Drupal 5.6 (working fine for 6 months and did no updates in the last 3 months)
    Site 3 Drupal 5.7 (working for 2 months and did jquery_update)
    These are not subdomains, but addon domains.
    Please help

    sime’s picture

    For the record, this happened to me on D5 with js aggregator installed by the files directory wasn't 777. JS files weren't being cleared causing conflicts.

    PeteS’s picture

    That was the case for me as well, thanks.

    machinez’s picture

    This too was the case for me. In performance section after optimizing the javascript files.

    This was the solution as outlined by eriktoyra above. The file page.tpl.php in the active theme was changed. $scripts moved to the bottom, with $closure following it. "Drupal is undefined" error went away.

    <?php print $scripts ?>
      <?php print $closure ?>
      </body>
    </html>
    
    Anonymous’s picture

    I started getting this error after *replacing* my misc folder with my JQuery update. Typically I copy all (overwriting the existing files) but I misread the installation message I guess. Be sure to copy (recursively) all files from your JQuery update into the existing misc folder.

    Do not move or delete the misc folder and replace it with the JQuery one!