Modify

Opened 6 years ago

Last modified 5 years ago

#5361 new defect

[new version] script does not work well with multi-trac installations

Reported by: thinice Owned by: dwclifton
Priority: normal Component: LoggedInScript
Severity: normal Keywords: login
Cc: thinice@… Trac Release: 0.11

Description

If you have multiple instances installed under a single handler it won't pick up the extra path.

e.g.: www.blah.com/trac (works fine) www.blah.com/projects/tracInstance1 (doesn't pick up the dir correctly)

Below may be a slightly more flexible solution


 <head py:match="head" py:attrs="select('@*')">
  ${select('*')}
  <script type="text/javascript">
   jQuery(document).ready(function($) {
     $('#metanav li.first:contains("logged in as")').each(function() {
       var path = $('#mainnav li.first a').attr('href').split('/');
        path.pop();
        path = path.join('/');
       var user = $(this).text().split(' ').pop();
       var link = '<a href="' + path + '/wiki/' + user + '">' + user + '</a>';
       $(this).html('logged in as ' + link);
       return false;
     });
   });
  </script>
 </head>

Attachments (0)

Change History (1)

comment:1 Changed 5 years ago by hasienda

  • Keywords login added
  • Summary changed from Script does not work well with multi-trac installations to [new version] script does not work well with multi-trac installations

I just wanted to reflect in the title, that there is already a solution in here.

Add Comment

Modify Ticket

Action
as new The owner will remain dwclifton.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.