Skip to content
albanmartel edited this page May 6, 2014 · 1 revision

Packages

Introduction

For more information about packages, see the Synthesepy#Packages chapter.

Common Package Usage Instructions

The require.js library is used to manage JavaScript loading and dependency management.

The list of packages to load can be specified in the initial require call. Here’s an example of package usage:

  <!-- GMap doesn't load correctly through require.js -->
  <script src="http://maps.google.com/maps/api/js?v=3.5&amp;sensor=false"></script>
  <script src="/core/vendor/requirejs/require.js"></script>
  <script data-version=1 src="/core/js/init.js"></script>
  <script>

  var stopSelector;
  require([
    "core/js/Synthese",
    "map/js/CityBrowser",
    "routePlanner/js/RoutePlanner",
    "map/js/StopSelector",
    "routePlanner/js/legacy/core",
    "routePlanner/js/legacy/interface",
  ], function(Synthese, CityBrowser, routePlanner, StopSelector) {
    Synthese.init();

    legacyRoutePlannerConfig.minCharsToTriggerAutocomplete = 0;
    legacyRoutePlannerConfig.routePlannerFormName = "routePlannerForm";

    routePlanner.initAutoCompletions();

    var form = document.getElementsByName("routePlannerForm")[0];
    form.siteId.value = Synthese.siteId;

    var stopSelector = new StopSelector({
      routePlanner: new routePlanner.RoutePlannerView({el: form}),
      routePlannerOptions: {
        formName: legacyRoutePlannerConfig.routePlannerFormName
      }
    });

    if (localStorage.debug_showMap)
      $(".mapLink:first").trigger("click");
  });

Packages list

{{child_pages}}

Manual installation

  1. install the synthese package

    apt-get install curl python net-tools
    curl -s http://ci.rcsmobility.com/~build/synthese/lin/release/trunk/latest/install_synthese.py | python

The next steps are not necessary if you are using the new generated apache config. See Projects_Administration.

  1. Add the packages aliases to Apache.

    Alias /core /opt/synthese/share/synthese/packages/core/files/core
    <Directory /opt/synthese/share/synthese/packages/core/files/core>
    Options -Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
Alias /map /opt/synthese/share/synthese/packages/map/files/map <Directory /opt/synthese/share/synthese/packages/map/files/map> Options -Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all Alias /routePlanner /opt/synthese/share/synthese/packages/routePlanner/files/routePlanner <Directory /opt/synthese/share/synthese/packages/routePlanner/files/routePlanner> Options -Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all Alias /timetable /opt/synthese/share/synthese/packages/timetable/files/timetable <Directory /opt/synthese/share/synthese/packages/timetable/files/timetable> Options -Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all Alias /admin /opt/synthese/share/synthese/packages/admin/files/admin <Directory /opt/synthese/share/synthese/packages/admin/files/admin> Options -Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all
  1. reload apache
  2. If you want to use project specific packages, first create your project in subversion and then check it out in (do the checkout using the synthese user) /srv/synthese/PROJECT_NAME.
  3. Example apache configuration (inside a vhost!) for using the main package files:

    DocumentRoot /srv/synthese/chablais/sites/chablais.ch/main/files/
    <Directory “/srv/synthese/chablais/sites/chablais.ch/main/files/”>
    AllowOverride None
    Options FollowSymLinks
    Order allow,deny
    Allow from all
    RewriteEngine on
    RewriteBase /

RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule ^(.*)$ synthese?fonction=page&si=7036874417766411&smart_url=/$1 [L,QSA]

Tips : site id is often 7036874417766402

Updating Synthese packages

A package is built on http://ci.rcsmobility.com/~build/synthese/lin/release/trunk/ on every commit.

Updating Synthese will update the packages:


curl -s http://ci.rcsmobility.com/~build/synthese/lin/release/trunk/latest/install_synthese.py | python

If the supervisor is already launched you can ignore this error:


Starting supervisor: Error: Another program is already listening on a port that one of our HTTP servers is configured to use. Shut this program down first before starting supervisord.

Packages properties

package name base_page_index
core 0
admin 1
map 2
routePlanner 3
testData 4
demo 5
networkExplorer 6
timetable 7
Clone this wiki locally