When using admin_menu with civicrm and editing a contact record, the contents of every "a" tag on the page gets replaced with the user count. Probably this is caused by some un-closed tag near the beginning of the content, but I haven't found the culprit yet.

The attached patch works around the problem by making the replacement more selective.

Comments

Status: Needs review » Needs work

The last submitted patch, admin_menu-user_count.patch, failed testing.

pillarsdotnet’s picture

Status: Needs work » Needs review

admin_menu-user_count.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, admin_menu-user_count.patch, failed testing.

pillarsdotnet’s picture

Status: Needs work » Active

Okay, I give up. I can't imagine why changing a javascript selector would produce a fatal error.

sun’s picture

Status: Active » Postponed (maintainer needs more info)

This patch is not able to make a difference, because the executed JS is limited to the #admin-menu context anyway already:

/**
 * Perform dynamic replacements in cached menu.
 */
Drupal.admin.behaviors.replacements = function (context, settings, $adminMenu) {
  for (var item in settings.admin_menu.replacements) {
    $(item, $adminMenu).html(settings.admin_menu.replacements[item]);
  }
}
Mac Clemmens’s picture

StatusFileSize
new471 bytes

Could this be the problem?

You are missing the semicolon after two functions you define in Drupal.behaviors:

Drupal.admin.behaviors.replacements
Drupal.admin.behaviors.destination

Which caused all kinds of things to go on the fritz on my site, from intermittently broken drag and dropping functionality to other issues.

My apologies if you're already corrected this problem.

Here's a patch:

--- admin_menu.js (saved version)
+++ (current document)
@@ -166,7 +166,7 @@
   for (var item in settings.admin_menu.replacements) {
     $(item, $adminMenu).html(settings.admin_menu.replacements[item]);
   }
-}
+};
 
 /**
  * Inject destination query strings for current page.
@@ -177,7 +177,7 @@
       this.search += (!this.search.length ? '?' : '&') + Drupal.settings.admin_menu.destination;
     });
   }
-}
+};
 
 /**
  * Apply JavaScript-based hovering behaviors.

Mac Clemmens’s picture

Also noticed that the getCache function was also missing a semicolon.

pillarsdotnet’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new950 bytes

Thank you!

With this patch I am (so far) not experiencing the originally-reported problem.

pillarsdotnet’s picture

StatusFileSize
new879 bytes

Trivial correction; my hand-edited patch had some cruft in it.

pillarsdotnet’s picture

StatusFileSize
new238.88 KB
new121.24 KB

After clearing caches and editing a contact record in civicrm, the problem returned.

Screenshot and page source attached.

EDIT: (Note that the page source is *after* javascript replacement; retrieved via firebug for Chrome)

pillarsdotnet’s picture

StatusFileSize
new436 bytes

The following patch fixes the problem for me, regardless of the objections in #5.

Status: Needs review » Needs work

The last submitted patch, admin_menu.patch, failed testing.

pillarsdotnet’s picture

Status: Needs work » Needs review

Why can't we have *both* a d6 and d7 testbot?

pillarsdotnet’s picture

Trying one more time before I give up on 6.x altogether.

pillarsdotnet’s picture

Status: Needs review » Closed (won't fix)