#28 ✓resolved
Brian Michalski

Javascript needs _ADMIN_BASE_URL_ access

Reported by Brian Michalski | September 2nd, 2009 @ 10:27 PM | in Concerto 1.9

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?

Comments and changes to this ticket

  • Michael DiTore

    Michael DiTore September 2nd, 2009 @ 11:11 PM

    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.

  • Brian Michalski

    Brian Michalski September 2nd, 2009 @ 11:21 PM

    • State changed from “new” to “resolved”

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

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Concerto is an open source digital signage system that makes it easy to engage a large community of people with graphical and text-based announcements, bulletins, and other messages... but enough about us, you came here to get involved.
<br />
If you think you've <b>found a bug in Concerto</b>, please click 'Create new ticket' and let us know about it.
<br />
Looking to peek at our source code? Head to <a href="https://github.com/concerto/concerto_v1">https://github.com/concerto/concerto_v1</a> (Concerto version 1) or <a href="https://github.com/concerto/concerto">https://github.com/concerto/concerto</a> (Concerto version 2).
<br />
Our getting started guide is available here: <a href="https://github.com/concerto/concerto/wiki/Getting-Involved">https://github.com/concerto/concerto/wiki/Getting-Involved</a>.

People watching this ticket

Referenced by

Pages