Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Javascript needs _ADMIN_BASE_URL_ access

#28

To make the fpnew.js file work with both the /admin/index.php and /pages/show/front URLS we have to define a non-relative path to the miniscreen action. My fix looks something like this:


 var height = 190;
 
 $(document).ready(function(){
-       $.getJSON("../../frontpage/miniscreen", function(json) {
+       $.getJSON(ADMIN_URL + "frontpage/miniscreen", function(json) {
                $.each(json['ticker'], function() {
                        ticker.push(this);
                });

Where ADMIN_URL is defined setup in the page content:

<script type="text/javascript">
  var ADMIN_URL = "_ADMIN_BASE_URL_";
</script>

Is this the kosher way to deal with this or is there a better way to get an absolute path?

Reported by Brian Michalski · September 2nd, 2009 @ 10:27 PM

State: resolved
Milestone: Concerto 1.9
Assigned to: Michael DiTore Michael DiTore

Activity

  1. Michael DiTore
    Michael DiTore

    I fully support this method. Because of varying server configurations (e.g., lack of mod_rewrite), and routing issues that come into play when the frontpage is overriden by another Concerto page, we can't reference resources reliably by using relative paths such as '../'. I also don't want to get into modifying the javascript somehow.

    As far as the javascript itself goes, I'm far from knowledgeable on how it works. It would seem somewhat cleaner if the Screen was initiated by some sort of method call on the page, that could perhaps take the location as an argument. That aside, I see no reason that the above method would be any less robust or efficient. Let's go for it!

    Once the above is tested, and committed we should be able to close this ticket.

    September 2nd, 2009 @ 11:11 PM

  2. Brian Michalski
    Brian Michalski
    • State changed from new to resolved

    (from [646]) Fixing the JS path so its absolute instead of relative. [#28 Javascript needs _ADMIN_BASE_URL_ access state:resolved]

    September 2nd, 2009 @ 11:21 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.