Loading ...
Sorry, an error occurred while loading the content.

Not obeying directory loading structure

Expand Messages
  • Ben McClure
    I have been trying all day to get Ajile to properly load my classes from a directory structure. My javascript is all in /js Ajile is at /js/com/iskitz/ajile.js
    Message 1 of 3 , Apr 22, 2010
    • 0 Attachment
      I have been trying all day to get Ajile to properly load my classes from a directory structure.

      My javascript is all in /js

      Ajile is at /js/com/iskitz/ajile.js
      My Main class is at: /js/com/singularityshift/webmanager/main.js

      My index file (along with some other valid JS) has the following:

      ---------------------------------------------
      // Set Ajile options
      Ajile.EnableCloak(false);
      Ajile.EnableDebug();
      Ajile.EnableOverride(false);
      Ajile.EnableRefresh(true);

      // Load third-party libraries
      Load('/js/jquery-1.4.2.min.js');
      Load('/js/jquery-ui-1.8.custom.min.js');
      Load('/js/jquery.bgiframe-2.1.1.js');
      Load('/js/jquery.cookie.js');
      Load('/js/jquery.metadata.js');

      // Define container namespace
      Namespace('com.singularityshift', null, '/');

      // Define application namespace
      Namespace('com.singularityshift.webmanager');

      // Import the main application class
      Include('com.singularityshift.webmanager.Main');

      Ajile.AddImportListener(function(moduleName) {
      alert(moduleName);
      });
      --------------------------------------------------------

      I only get one alert box which says 'com.iskitz.ajile'

      When I look at the console output in Firebug, I can see it is using '.' as a separator and trying to load all of my classes using the default method instead of obeying neither the loading structure i used for ajile.js nor the '/' separator I specified in the namespace.

      --

      On a possibly-related note, this is a CakePHP site and if you try to load a file from /js that does not exist, you get a CakePHP-generated HTML error page instead of a generic 404... could it be trying to load the non-existent page, thinking it's valid, and not looking any further?
    • Ben McClure
      I found the problem. Every call to Namespace() resets the separator character to . unless otherwise specified. So in my second Namespace (and every other
      Message 2 of 3 , Apr 22, 2010
      • 0 Attachment
        I found the problem.

        Every call to Namespace() resets the separator character to '.' unless otherwise specified. So in my second Namespace (and every other one) it seems I need to specify the third parameter as '/'

        --- In ajile@yahoogroups.com, "Ben McClure" <digitalempire@...> wrote:
        >
        > I have been trying all day to get Ajile to properly load my classes from a directory structure.
        >
        > My javascript is all in /js
        >
        > Ajile is at /js/com/iskitz/ajile.js
        > My Main class is at: /js/com/singularityshift/webmanager/main.js
        >
        > My index file (along with some other valid JS) has the following:
        >
        > ---------------------------------------------
        > // Set Ajile options
        > Ajile.EnableCloak(false);
        > Ajile.EnableDebug();
        > Ajile.EnableOverride(false);
        > Ajile.EnableRefresh(true);
        >
        > // Load third-party libraries
        > Load('/js/jquery-1.4.2.min.js');
        > Load('/js/jquery-ui-1.8.custom.min.js');
        > Load('/js/jquery.bgiframe-2.1.1.js');
        > Load('/js/jquery.cookie.js');
        > Load('/js/jquery.metadata.js');
        >
        > // Define container namespace
        > Namespace('com.singularityshift', null, '/');
        >
        > // Define application namespace
        > Namespace('com.singularityshift.webmanager');
        >
        > // Import the main application class
        > Include('com.singularityshift.webmanager.Main');
        >
        > Ajile.AddImportListener(function(moduleName) {
        > alert(moduleName);
        > });
        > --------------------------------------------------------
        >
        > I only get one alert box which says 'com.iskitz.ajile'
        >
        > When I look at the console output in Firebug, I can see it is using '.' as a separator and trying to load all of my classes using the default method instead of obeying neither the loading structure i used for ajile.js nor the '/' separator I specified in the namespace.
        >
        > --
        >
        > On a possibly-related note, this is a CakePHP site and if you try to load a file from /js that does not exist, you get a CakePHP-generated HTML error page instead of a generic 404... could it be trying to load the non-existent page, thinking it's valid, and not looking any further?
        >
      • Ben McClure
        And I was naming my class file main.js but it needed to be Main.js with an uppercase letter to load properly.
        Message 3 of 3 , Apr 22, 2010
        • 0 Attachment
          And I was naming my class file "main.js" but it needed to be "Main.js" with an uppercase letter to load properly.

          --- In ajile@yahoogroups.com, "Ben McClure" <digitalempire@...> wrote:
          >
          > I have been trying all day to get Ajile to properly load my classes from a directory structure.
          >
          > My javascript is all in /js
          >
          > Ajile is at /js/com/iskitz/ajile.js
          > My Main class is at: /js/com/singularityshift/webmanager/main.js
          >
          > My index file (along with some other valid JS) has the following:
          >
          > ---------------------------------------------
          > // Set Ajile options
          > Ajile.EnableCloak(false);
          > Ajile.EnableDebug();
          > Ajile.EnableOverride(false);
          > Ajile.EnableRefresh(true);
          >
          > // Load third-party libraries
          > Load('/js/jquery-1.4.2.min.js');
          > Load('/js/jquery-ui-1.8.custom.min.js');
          > Load('/js/jquery.bgiframe-2.1.1.js');
          > Load('/js/jquery.cookie.js');
          > Load('/js/jquery.metadata.js');
          >
          > // Define container namespace
          > Namespace('com.singularityshift', null, '/');
          >
          > // Define application namespace
          > Namespace('com.singularityshift.webmanager');
          >
          > // Import the main application class
          > Include('com.singularityshift.webmanager.Main');
          >
          > Ajile.AddImportListener(function(moduleName) {
          > alert(moduleName);
          > });
          > --------------------------------------------------------
          >
          > I only get one alert box which says 'com.iskitz.ajile'
          >
          > When I look at the console output in Firebug, I can see it is using '.' as a separator and trying to load all of my classes using the default method instead of obeying neither the loading structure i used for ajile.js nor the '/' separator I specified in the namespace.
          >
          > --
          >
          > On a possibly-related note, this is a CakePHP site and if you try to load a file from /js that does not exist, you get a CakePHP-generated HTML error page instead of a generic 404... could it be trying to load the non-existent page, thinking it's valid, and not looking any further?
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.