diff --git a/babel-setup.sql b/babel-setup.sql
index 6106cb2..98d397a 100644
--- a/babel-setup.sql
+++ b/babel-setup.sql
@@ -34,7 +34,7 @@
   `pct_complete` float NOT NULL,
   PRIMARY KEY  (`file_id`, `language_id`),
   CONSTRAINT `file_progress_ibfk_1` FOREIGN KEY (`file_id`) REFERENCES `files` (`file_id`) ON UPDATE CASCADE ON DELETE CASCADE,
-    CONSTRAINT `file_progress_ibfk_2` FOREIGN KEY (`language_id`) REFERENCES `languages` (`language_id`) ON UPDATE CASCADE ON DELETE CASCADE
+  CONSTRAINT `file_progress_ibfk_2` FOREIGN KEY (`language_id`) REFERENCES `languages` (`language_id`) ON UPDATE CASCADE ON DELETE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 DROP TABLE IF EXISTS `files`;
@@ -94,16 +94,13 @@
 -- Table structure for table `map_files`
 --
 
-DROP TABLE IF EXISTS `map_files`;
-CREATE TABLE `map_files` (
+DROP TABLE IF EXISTS `project_source_locations`;
+CREATE TABLE `project_source_locations` (
   `project_id` varchar(100) NOT NULL,
   `version` varchar(64) NOT NULL,
-  `filename` varchar(100) NOT NULL,
   `location` varchar(255) NOT NULL,
-  `is_active` tinyint(3) unsigned NOT NULL default '1',
-  `is_map_file` tinyint(3) unsigned NOT NULL default '1',
-  PRIMARY KEY  (`project_id`, `version`, `filename`),
-  CONSTRAINT `map_files_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `projects` (`project_id`) ON UPDATE CASCADE ON DELETE CASCADE
+  PRIMARY KEY  (`project_id`, `version`, `location`),
+  CONSTRAINT `project_source_locations_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `projects` (`project_id`) ON UPDATE CASCADE ON DELETE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 --
@@ -490,136 +487,47 @@
 insert into languages values (null, "sk",    null,          "Slovak",     1);
 insert into languages values (null, "eu",    null,          "Basque",     1);
 insert into languages values (null, "ml",    null,          "Malayalam",  1);
-
 insert into languages values (null, "tl",    null,          "Klingon",    1);
 
-insert into projects set project_id = 'eclipse', is_active = 1 ;
+insert into release_trains values ("kepler", "4.3.0", 1);
 
-insert into project_versions set project_id = "eclipse", version = "3.3", is_active = 1;
-insert into project_versions set project_id = "eclipse", version = "3.4", is_active = 1;
-insert into project_versions set project_id = "eclipse", version = "3.5", is_active = 1;
-insert into project_versions set project_id = "eclipse", version = "3.6", is_active = 1;
-insert into project_versions set project_id = "eclipse", version = "3.7", is_active = 1;
-insert into project_versions set project_id = "eclipse", version = "4.1", is_active = 1;
+insert into projects values ("eclipse", 1);
+insert into projects values ("eclipse.orion", 1);
 
-insert into release_trains values ('europa',   '3.3.0', 1);
-insert into release_trains values ('ganymede', '3.4.0', 1);
-insert into release_trains values ('galileo',  '3.5.0', 1);
-insert into release_trains values ('helios',   '3.6.0', 1);
-insert into release_trains values ('indigo',   '3.7.0', 1);
+insert into project_versions values ("eclipse", "4.3", 1);
+insert into project_versions values ("eclipse.orion", "2.0", 1);
+
+insert into release_train_projects values ("kepler", "eclipse", "4.3");
+insert into release_train_projects values ("kepler", "eclipse.orion", "2.0");
 
-insert into release_train_projects values ('europa',   'eclipse', '3.3');
-insert into release_train_projects values ('ganymede', 'eclipse', '3.4');
-insert into release_train_projects values ('galileo',  'eclipse', '3.5');
-insert into release_train_projects values ('helios',   'eclipse', '3.6');
-insert into release_train_projects values ('indigo',   'eclipse', '3.7');
-insert into release_train_projects values ('indigo',   'eclipse', '4.1');
+insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/equinox/rt.equinox.framework.git/snapshot/I20121210-2000.zip");
+insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/equinox/rt.equinox.p2.git/snapshot/I20130108-0800.zip");
+insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/jdt/eclipse.jdt.git/snapshot/I20121210-2000.zip");
+insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/snapshot/I20130101-0800.zip");
+insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/snapshot/I20121225-0800.zip");
+insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/snapshot/I20121225-0800.zip");
+insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/pde/eclipse.pde.git/snapshot/I20121210-2000.zip");
+insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/pde/eclipse.pde.ui.git/snapshot/I20121218-0800.zip");
+insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.git/snapshot/I20130101-0800.zip");
+insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.debug.git/snapshot/I20121225-0800.zip");
+insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.team.git/snapshot/I20121212-2000.zip");
+insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.text.git/snapshot/I20121225-0800.zip");
+insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.ua.git/snapshot/I20121218-0800.zip");
+insert into project_source_locations values ("eclipse", "4.3", "http://git.eclipse.org/c/platform/eclipse.platform.ui.git/snapshot/I20121225-0800.zip");
+insert into project_source_locations values ("eclipse.orion", "2.0", "http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/snapshot/org.eclipse.orion.client-20130222-1757.zip");
 
-/* MAP INPUTS */
-insert into map_files values ("eclipse", "3.3", "ant.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/ant.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "base.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/base.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "compare.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/compare.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "core-hpux.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/core-hpux.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "core-macosx.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/core-macosx.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "core-qnx.map","http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/core-qnx.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "core-variables.map","http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/core-variables.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "core.map","http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/core.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "doc.map","http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/doc.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "equinox-incubator.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/equinox-incubator.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "feature.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/feature.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "jdtapt.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/jdtapt.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "jdtcore.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/jdtcore.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "jdtdebug.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/jdtdebug.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "jdtui.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/jdtui.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "orbit.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/orbit.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "pde.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/pde.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "rcp.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/rcp.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "releng.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/releng.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "swt.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/swt.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "team.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/team.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "testframework.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/testframework.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "text.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/text.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "ui.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/ui.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "update.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/update.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.3", "userassist.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/userassist.map?view=co&pathrev=R3_3", 1, 1);
-insert into map_files values ("eclipse", "3.4", "ant.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/ant.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "base.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/base.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "compare.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/compare.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "core-hpux.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/core-hpux.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "core-macosx.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/core-macosx.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "core-qnx.map","http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/core-qnx.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "core-variables.map","http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/core-variables.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "core.map","http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/core.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "doc.map","http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/doc.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "equinox-incubator.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/equinox-incubator.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "feature.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/feature.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "jdtapt.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/jdtapt.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "jdtcore.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/jdtcore.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "jdtdebug.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/jdtdebug.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "jdtui.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/jdtui.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "orbit.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/orbit.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "pde.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/pde.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "rcp.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/rcp.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "releng.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/releng.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "swt.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/swt.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "team.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/team.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "testframework.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/testframework.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "text.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/text.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "ui.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/ui.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "update.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/update.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.4", "userassist.map", "http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.releng/maps/userassist.map?view=co&pathrev=R3_4", 1, 1);
-insert into map_files values ("eclipse", "3.5", "eclipse-3.5-update-site", "http://download.eclipse.org/eclipse/updates/3.5/R-3.5-200906111540", 1, 0);
-insert into map_files values ("eclipse", "3.6", "eclipse-3.6-update-site", "http://download.eclipse.org/eclipse/updates/3.6/R-3.6-201006080911", 1, 0);
-insert into map_files values ("eclipse", "3.7", "eclipse-3.7-update-site", "http://download.eclipse.org/eclipse/updates/3.7/R-3.7-201106131736", 1, 0);
-insert into map_files values ("eclipse", "4.1", "eclipse-4.1-update-site", "http://download.eclipse.org/eclipse/updates/4.1/R-4.1-201106201631", 1, 0);
-
-insert into plugin_exclude_patterns values ("eclipse", "3.5", "/^com\\.ibm\\.icu.*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.5", "/^com\\.jcraft\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.5", "/^javax\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.5", "/^org\\.apache\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.5", "/^org\\.hamcrest\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.5", "/^org\\.junit.*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.5", "/^org\\.mortbay\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.5", "/^org\\.objectweb\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.5", "/^org\\.sat4j\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.5", "/^org\\.w3c\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.5", "/^.*\\/jface\\/resource\\/.*$/");
-
-insert into plugin_exclude_patterns values ("eclipse", "3.6", "/^com\\.ibm\\.icu.*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.6", "/^com\\.jcraft\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.6", "/^javax\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.6", "/^org\\.apache\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.6", "/^org\\.hamcrest\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.6", "/^org\\.junit.*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.6", "/^org\\.mortbay\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.6", "/^org\\.objectweb\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.6", "/^org\\.sat4j\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.6", "/^org\\.w3c\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.6", "/^.*\\/jface\\/resource\\/.*$/");
-
-insert into plugin_exclude_patterns values ("eclipse", "3.7", "/^com\\.ibm\\.icu.*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.7", "/^com\\.jcraft\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.7", "/^javax\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.7", "/^org\\.apache\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.7", "/^org\\.hamcrest\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.7", "/^org\\.junit.*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.7", "/^org\\.mortbay\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.7", "/^org\\.objectweb\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.7", "/^org\\.sat4j\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.7", "/^org\\.w3c\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "3.7", "/^.*\\/jface\\/resource\\/.*$/");
-
-insert into plugin_exclude_patterns values ("eclipse", "4.1", "/^com\\.ibm\\.icu.*$/");
-insert into plugin_exclude_patterns values ("eclipse", "4.1", "/^com\\.jcraft\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "4.1", "/^javax\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "4.1", "/^org\\.apache\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "4.1", "/^org\\.hamcrest\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "4.1", "/^org\\.junit.*$/");
-insert into plugin_exclude_patterns values ("eclipse", "4.1", "/^org\\.mortbay\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "4.1", "/^org\\.objectweb\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "4.1", "/^org\\.sat4j\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "4.1", "/^org\\.w3c\\..*$/");
-insert into plugin_exclude_patterns values ("eclipse", "4.1", "/^.*\\/jface\\/resource\\/.*$/");
+insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^com\\.ibm\\.icu.*$/");
+insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^com\\.jcraft\\..*$/");
+insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^javax\\..*$/");
+insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.apache\\..*$/");
+insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.hamcrest\\..*$/");
+insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.junit.*$/");
+insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.mortbay\\..*$/");
+insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.objectweb\\..*$/");
+insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.sat4j\\..*$/");
+insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^org\\.w3c\\..*$/");
+insert into plugin_exclude_patterns values ("eclipse", "4.3", "/^.*\\/jface\\/resource\\/.*$/");
+insert into plugin_exclude_patterns values ("eclipse.orion", "2.0", "/^.*\\/bundle.properties$/");
 
 /* populate file_progress table  */
 /* See also: dbmaintenance_15min.php */
diff --git a/classes/export/generate1.php b/classes/export/generate1.php
index 7040feb..be83558 100755
--- a/classes/export/generate1.php
+++ b/classes/export/generate1.php
@@ -1,6 +1,6 @@
 <?php
 /*******************************************************************************
- * Copyright (c) 2008 Eclipse Foundation and others.
+ * Copyright (c) 2008-2013 Eclipse Foundation, IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -26,6 +26,7 @@
  *    Kit Lo (IBM) - [330735] Generate a better id for the categories
  *    Kit Lo (IBM) - [313310] Support Eclipse-PlatformFilter for fragment of fragment
  *    Satoru Yoshida - [349107] properties file for template is located in wrong path
+ *    Kit Lo (IBM) - [402215] Extract Orion JavaScript files for translation
  *******************************************************************************/
 
 /*
@@ -74,7 +75,7 @@
 	$build_id = $options['b'];
 }
 
-$release_id = "0.10.1";
+$release_id = "0.11.0";
 
 $work_dir = $addon->callHook('babel_working');
 
@@ -90,8 +91,11 @@
 $leader = ". . ";
 $timestamp = date("Ymdhis");
 
-$rm_command = "rm -rf $tmp_dir; rm -rf $babel_language_packs_dir; rm -rf $output_dir";
-exec($rm_command);
+# Generate Orion language packs
+exec("php5 generate_orion.php -b $build_id");
+
+# Generate Babel language packs
+exec("rm -rf $tmp_dir; rm -rf $output_dir");
 exec("mkdir -p $output_dir");
 
 echo "Requested builds: ";
@@ -174,6 +178,7 @@
 
 		$plugins = array();
 		$projects = array();
+		$projects_include_orion = array();
 		$project_versions = array();
 		$pseudo_translations_indexes = array();
 		while (($file_row = mysql_fetch_assoc($file_result)) != null) {
@@ -215,7 +220,13 @@
 			$file_row['dir_name'] = $dir_name_string;
 			$file_row['file_name'] = $file_name_string;
 
-			$plugins[$plugin_name_string][] = $file_row;
+			if (preg_match("/^(.*)\.js$/", $plugin_name_string)) {
+				$project_id = $file_row['project_id'];
+				$projects_include_orion[$project_id][] = "eclipse.orion";
+				$project_versions[$project_id] = $file_row['version'];
+			} else {
+				$plugins[$plugin_name_string][] = $file_row;
+			}
 		}
 
 		/*
@@ -472,13 +483,15 @@
 			echo "${leader}${leader}Completed  plug-in fragment $plugin_name\n";
 
 			$projects[$project_id][] = $fragment_id;
+			$projects_include_orion[$project_id][] = $fragment_id;
 			$project_versions[$project_id] = $properties_file['version'];
 		}
 		if (sizeof($projects) > 0) {
 			$site_xml .= "\n\t<category-def name=\"lang_$language_iso\" label=\"Babel Language Packs in $language_name\">";
 			$site_xml .= "\n\t\t<description>Babel Language Packs in $language_name</description>";
 			$site_xml .= "\n\t</category-def>";
-
+		}
+		if (sizeof($projects_include_orion) > 0) {
 			fwrite($language_pack_links_file, "\n\t\t<a href='#$language_iso'>$language_name</a>");
 			if (strcmp($language_iso, "en_AA") != 0) {
 				fwrite($language_pack_links_file, ",");
@@ -486,8 +499,8 @@
 			$language_pack_links_file_buffer .= "\n\t<h4>Language: <a name='$language_iso'>$language_name</a></h4>";
 			$language_pack_links_file_buffer .= "\n\t<ul>";
 		}
-		ksort($projects);
-		foreach ($projects as $project_id => $fragment_ids) {
+		ksort($projects_include_orion);
+		foreach ($projects_include_orion as $project_id => $fragment_ids) {
 			/*
 			 * Sort fragment names
 			 */
@@ -520,9 +533,11 @@
 
 			if (strcmp($language_iso, "en_AA") == 0) {
 				$project_pct_complete = 100;
-				$site_xml .= "\n\t<category-def name=\"proj_$project_id\" label=\"Babel Language Packs for $project_id\">";
-				$site_xml .= "\n\t\t<description>Babel Language Packs for $project_id</description>";
-				$site_xml .= "\n\t</category-def>";
+				if (strcmp($project_id, "eclipse.orion") != 0) {
+					$site_xml .= "\n\t<category-def name=\"proj_$project_id\" label=\"Babel Language Packs for $project_id\">";
+					$site_xml .= "\n\t\t<description>Babel Language Packs for $project_id</description>";
+					$site_xml .= "\n\t</category-def>";
+				}
 			} else {
 				$project_version = $project_versions[$project_id];
 				$sql = "SELECT pct_complete
@@ -546,14 +561,16 @@
 				"\n\t<license url=\"%licenseURL\">\n\t\t%license\n\t</license>" .
 				"\n\t<description>Babel Language Pack for $project_id in $language_name</description>" );
 			foreach ($fragment_ids as $fragment_id) {
-				$jar_name = "${output_dir_for_train}plugins/${fragment_id}_$train_version_timestamp.jar";
-				$size = filesize($jar_name);
-				fwrite($outp, "\n\t<plugin fragment=\"true\" id=\"$fragment_id\" unpack=\"false\" " .
-					"version=\"$train_version_timestamp\" download-size=\"$size\" install-size=\"$size\" />");
-				/*
-				 * Copy the plugin to ${babel_language_packs_dir_for_train}tmp
-				 */
-				exec("cp ${output_dir_for_train}plugins/${fragment_id}_$train_version_timestamp.jar ${babel_language_packs_dir_for_train}tmp/eclipse/plugins");
+				if (strcmp($fragment_id, "eclipse.orion") != 0) {
+					$jar_name = "${output_dir_for_train}plugins/${fragment_id}_$train_version_timestamp.jar";
+					$size = filesize($jar_name);
+					fwrite($outp, "\n\t<plugin fragment=\"true\" id=\"$fragment_id\" unpack=\"false\" " .
+						"version=\"$train_version_timestamp\" download-size=\"$size\" install-size=\"$size\" />");
+					/*
+					 * Copy the plugin to ${babel_language_packs_dir_for_train}tmp
+					 */
+					exec("cp ${output_dir_for_train}plugins/${fragment_id}_$train_version_timestamp.jar ${babel_language_packs_dir_for_train}tmp/eclipse/plugins");
+				}
 			}
 			fwrite($outp, "\n</feature>");
 			fclose($outp);
@@ -568,7 +585,7 @@
 			/*
 			 * Copy in the Babel Pseudo Translations Index file
 			 */
-			if (strcmp($language_iso, "en_AA") == 0) {
+			if (strcmp($language_iso, "en_AA") == 0 && strcmp($project_id, "eclipse.orion") != 0) {
 				$pseudo_translations_index_file = fopen("${output_dir}BabelPseudoTranslationsIndex-$project_id.html", "w");
 				fwrite($pseudo_translations_index_file, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">" .
 					"\n<html>\n<head>\n<title>Babel Pseudo Translations Index for $project_id</title>" .
@@ -592,7 +609,9 @@
 			 * Zip up language pack
 			 */
 			$language_pack_name = "BabelLanguagePack-$project_id-${language_iso}_$train_version_timestamp.zip";
-			exec("cd ${babel_language_packs_dir_for_train}tmp; zip -r $babel_language_packs_dir_for_train$language_pack_name eclipse");
+			if (strcmp($project_id, "eclipse.orion") != 0) {
+				exec("cd ${babel_language_packs_dir_for_train}tmp; zip -r $babel_language_packs_dir_for_train$language_pack_name eclipse");
+			}
 			/*
 			 * Clean up ${babel_language_packs_dir_for_train}tmp
 			 */
@@ -604,7 +623,9 @@
 			/*
 			 * Jar up this directory as the feature jar
 			 */
-			system("cd $tmp_dir; jar cfM ${output_dir_for_train}features/$feature_filename .");
+			if (strcmp($project_id, "eclipse.orion") != 0) {
+				system("cd $tmp_dir; jar cfM ${output_dir_for_train}features/$feature_filename .");
+			}
 			/*
 			 * Clean the temporary directory
 			 */
@@ -612,13 +633,15 @@
 			/*
 			 * Register this feature with the site.xml
 			 */
-			$site_xml .= "\n\t<feature url=\"features/$feature_filename\" id=\"$feature_id\" version=\"$train_version_timestamp\">";
-			$site_xml .= "\n\t\t<category name=\"proj_$project_id\"/>";
-			$site_xml .= "\n\t\t<category name=\"lang_$language_iso\"/>";
-			$site_xml .= "\n\t</feature>";
+			if (strcmp($project_id, "eclipse.orion") != 0) {
+				$site_xml .= "\n\t<feature url=\"features/$feature_filename\" id=\"$feature_id\" version=\"$train_version_timestamp\">";
+				$site_xml .= "\n\t\t<category name=\"proj_$project_id\"/>";
+				$site_xml .= "\n\t\t<category name=\"lang_$language_iso\"/>";
+				$site_xml .= "\n\t</feature>";
+			}
 		}  /*  End: foreach project  */
 		echo "${leader}Completed language pack for $language_name ($language_iso)\n";
-		if (sizeof($projects) > 0) {
+		if (sizeof($projects_include_orion) > 0) {
 			$language_pack_links_file_buffer .= "\n\t</ul>";
 		}
 	}
diff --git a/classes/export/generate_orion.php b/classes/export/generate_orion.php
new file mode 100644
index 0000000..be2c9a4
--- /dev/null
+++ b/classes/export/generate_orion.php
@@ -0,0 +1,289 @@
+<?php
+/*******************************************************************************
+ * Copyright (c) 2013 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Kit Lo (IBM) - [402215] Extract Orion JavaScript files for translation
+ *******************************************************************************/
+
+ini_set("memory_limit", "512M");
+require(dirname(__FILE__) . "/../system/dbconnection.class.php");
+
+# Get all release trains
+$dbc = new DBConnection();
+$dbh = $dbc->connect();
+$result = mysql_query("SELECT * FROM release_trains ORDER BY train_version DESC");
+$train_result = array();
+while ($train_row = mysql_fetch_assoc($result)) {
+  $train_result[$train_row['train_id']] = $train_row['train_version'];
+}
+
+$options = getopt("b:t:");
+$argv_train = "";
+if (isset($options['t'])) {
+	$argv_train = $options['t'];
+	if( array_key_exists($argv_train, $train_result)) {
+		# Picked a valid train, remove all others
+		foreach ($train_result as $train_id => $train_version) {
+			if ($train_id != $argv_train) {
+				unset($train_result[$train_id]);
+			}
+		}
+	}
+}
+
+$build_id = "";
+if (!isset($options['b'])) {
+	usage();
+	exit();
+} else {
+	$build_id = $options['b'];
+}
+
+global $addon;
+$work_dir = $addon->callHook('babel_working');
+$context = $addon->callHook('context');
+$work_context_dir = $work_dir . $context . "/";
+$orion_language_packs_dir = $work_context_dir . "orion_language_packs/";
+$babel_language_packs_dir = $work_context_dir . "babel_language_packs/";
+$source_files_dir = dirname(__FILE__) . "/source_files_for_orion/";
+
+$leader = ". ";
+$timestamp = date("Ymdhis");
+
+$rm_command = "rm -rf $orion_language_packs_dir";
+exec($rm_command);
+
+# Loop through the trains
+foreach ($train_result as $train_id => $train_version) {
+	echo "Generating language packs for: $train_id\n";
+
+	$orion_language_packs_dir_for_train = $orion_language_packs_dir . $train_id . "/";
+	exec("mkdir -p $orion_language_packs_dir_for_train");
+	
+	$babel_language_packs_dir_for_train = $babel_language_packs_dir . $train_id . "/";
+	exec("mkdir -p $babel_language_packs_dir_for_train");
+
+	$train_version_timestamp = "$train_version.v$timestamp";
+	$language_pack_links_file_buffer = "";
+	$site_xml = "";
+
+	$sql = "SELECT language_id, iso_code, IF(locale <> '', CONCAT(CONCAT(CONCAT(name, ' ('), locale), ')'), name) as name, IF(locale <> '', CONCAT(name, locale), name) as name_no_space, is_active, IF(language_id = 1,1,0) AS sorthack FROM languages ORDER BY sorthack, name ASC";
+	$language_result = mysql_query($sql);
+	if($language_result === FALSE) {
+		# We may have lost the database connection with our shell-outs, reconnect
+		$dbh = $dbc->connect();
+		$language_result = mysql_query($sql);
+	}
+	while (($language_row = mysql_fetch_assoc($language_result)) != null) {
+		$language_name = $language_row['name'];
+		$language_name_no_space = $language_row['name_no_space'];
+		$language_iso = $language_row['iso_code'];
+		$language_id = $language_row['language_id'];
+		if (strcmp($language_iso, "en") == 0) {
+			$language_name = "Pseudo Translations";
+			$language_name_no_space = "PseudoTranslations";
+			$language_iso = "en_AA";
+		}
+		$language_iso_web = str_replace("_", "-", strtolower($language_iso));
+
+		echo "${leader}Generating language pack for: $language_name ($language_iso) (language_id=" . $language_id . ")\n";
+
+		# Determine which plug-ins need to be in this language pack
+		if (strcmp($language_iso, "en_AA") == 0) {
+			$file_result = mysql_query("SELECT DISTINCT f.project_id, f.version, f.file_id, f.name
+				FROM files AS f
+				INNER JOIN strings AS s ON f.file_id = s.file_id
+				INNER JOIN release_train_projects as v ON (f.project_id = v.project_id AND f.version = v.version)
+				WHERE f.is_active
+				AND f.project_id = 'eclipse.orion'
+				AND v.train_id = '" . $train_id . "'");
+		} else {
+			$file_result = mysql_query("SELECT DISTINCT f.project_id, f.version, f.file_id, f.name
+				FROM files AS f
+				INNER JOIN strings AS s ON f.file_id = s.file_id
+				INNER JOIN release_train_projects as v ON (f.project_id = v.project_id AND f.version = v.version)
+				WHERE f.is_active
+				AND f.project_id = 'eclipse.orion'
+				AND v.train_id = '" . $train_id . "'");
+		}
+
+		$plugins = array();
+		$projects = array();
+		$project_versions = array();
+		$pseudo_translations_indexes = array();
+		while (($file_row = mysql_fetch_assoc($file_result)) != null) {
+			# parse plugin name, dir name, file name
+			$pattern = 
+				'/^
+				(.*?)?					# $1 plugin name
+				\/						# slash
+				(.*?\/)?				# $2 dir name
+				([^\/]+[.]js)			# $3 file name
+				$/ix';
+			$plugin_name_string = preg_replace($pattern, '$1', $file_row['name']);
+			$dir_name_string = preg_replace($pattern, '$2', $file_row['name']);
+			$file_name_string = preg_replace($pattern, '$3', $file_row['name']);
+
+			# Generate dir name in language pack
+			$dir_name_string = str_replace("web/", "", $dir_name_string);
+			$dir_name_string = str_replace("nls/root/", "nls/" . $language_iso_web . "/", $dir_name_string);
+
+			$file_row['plugin_name'] = $plugin_name_string;
+			$file_row['dir_name'] = $dir_name_string;
+			$file_row['file_name'] = $file_name_string;
+
+			$plugins[$plugin_name_string][] = $file_row;
+		}
+
+		# Generate one plug-in fragment for each plug-in
+		ksort($plugins);
+		foreach ($plugins as $plugin_name => $plugin_row) {
+			echo "${leader}${leader}Generating plug-in fragment: $plugin_name\n";
+
+			foreach ($plugin_row as $properties_file) {
+				$project_id = $properties_file['project_id'];
+				$dirname = $properties_file['dir_name'];
+				$filename = $properties_file['file_name'];
+				$each_language_pack_dir = "BabelLanguagePack-$project_id-${language_iso}/";
+
+				echo "${leader}${leader}${leader}Generating file: " . $plugin_name . "/" . $dirname . $filename . " (file_id=" . $properties_file['file_id'] . ")\n";
+				# Create any needed sub-directories
+				exec("mkdir -p " . $orion_language_packs_dir_for_train . $each_language_pack_dir . $plugin_name . "/" . $dirname);
+				$fullpath = $orion_language_packs_dir_for_train . $each_language_pack_dir . $plugin_name . "/" . $dirname . $filename;
+				$outp = fopen($fullpath, "w");
+				fwrite($outp, "// Copyright by many contributors; see http://babel.eclipse.org/\ndefine({");
+				$line_leader = null;
+				if (strcmp($language_iso, "en_AA") == 0) {
+					$sql = "SELECT string_id, name AS 'key', value FROM strings WHERE file_id = " . $properties_file['file_id'] .
+						" AND is_active AND non_translatable = 0";
+					$strings_result = mysql_query($sql);
+					while (($strings_row = mysql_fetch_assoc($strings_result)) != null) {
+						if ($line_leader == null) {
+							fwrite($outp, "\n  ");
+							$line_leader = ",\n  ";
+						} else {
+							fwrite($outp, $line_leader);
+						}
+				        $outp_line = "\"" . $strings_row['key'] . "\": \"" . $properties_file['project_id'] . $strings_row['string_id'] .
+								":" . $strings_row['value'] . "\"";
+						fwrite($outp, $outp_line);
+
+						$value = htmlspecialchars($strings_row['value']);
+						if (strlen($value) > 100) {
+							$value = substr($value, 0, 100) . " ...";
+						}
+						$pseudo_translations_indexes[$properties_file['project_id']][] = "\n\t\t<li><a href=\"http://babel.eclipse.org/babel/translate.php?project=" .
+						$properties_file['project_id'] . "&version=" . $properties_file['version'] . "&file=" .
+						$properties_file['name'] . "&string=" . $strings_row['key'] . "\">" .
+						$properties_file['project_id'] . $strings_row['string_id'] . "</a>&nbsp;" . $value . "</li>";
+					}
+				} else {
+					$sql = "SELECT
+						strings.name AS 'key', 
+						translations.value AS trans
+						FROM strings, translations
+						WHERE strings.string_id = translations.string_id
+						AND strings.file_id = " . $properties_file['file_id'] . "
+						AND strings.is_active
+						AND strings.non_translatable = 0
+						AND translations.language_id = " . $language_id . "
+						AND translations.is_active";
+					$strings_result = mysql_query($sql);
+					while (($strings_row = mysql_fetch_assoc($strings_result)) != null) {
+						if ($line_leader == null) {
+							fwrite($outp, "\n  ");
+							$line_leader = ",\n  ";
+						} else {
+							fwrite($outp, $line_leader);
+						}
+						fwrite($outp, "\"" . $strings_row['key'] . "\": \"" . $strings_row['trans'] . "\"");
+					}
+				}
+				/*
+				 * Finish the properties file
+				 */
+				fwrite($outp, "\n});");
+				fclose($outp);
+				echo "${leader}${leader}${leader}Completed  file: " . $plugin_name . "/" . $dirname . $filename . "\n";
+			}
+			echo "${leader}${leader}Completed  plug-in fragment: $plugin_name\n";
+
+			$parent_plugin_id = $plugin_name;
+			$project_id = $properties_file['project_id'];
+			$fragment_id = "$parent_plugin_id.nl_$language_iso";
+			$fragment_filename = "${fragment_id}_$train_version_timestamp.jar";
+
+			$projects[$project_id][] = $fragment_id;
+			$project_versions[$project_id] = $properties_file['version'];
+		}
+		ksort($projects);
+		foreach ($projects as $project_id => $fragment_ids) {
+			/*
+			 * Sort fragment names
+			 */
+			asort($fragment_ids);
+			/*
+			 * Copy in the build files
+			 */
+			exec("cp -r ${source_files_dir}* $orion_language_packs_dir_for_train$each_language_pack_dir");
+			exec("cd $orion_language_packs_dir_for_train$each_language_pack_dir; rename Plugin ${language_name_no_space}Plugin *.html");
+
+			exec("cd $orion_language_packs_dir_for_train$each_language_pack_dir; sed -e \"s/\[locale\]/$language_iso_web/g\" babelEditor*Plugin.html > /tmp/babelfile.$$; mv -f /tmp/babelfile.$$ babelEditor*Plugin.html");
+			exec("cd $orion_language_packs_dir_for_train$each_language_pack_dir; sed -e \"s/\[locale\]/$language_iso_web/g\" babelGit*Plugin.html > /tmp/babelfile.$$; mv -f /tmp/babelfile.$$ babelGit*Plugin.html");
+			exec("cd $orion_language_packs_dir_for_train$each_language_pack_dir; sed -e \"s/\[locale\]/$language_iso_web/g\" babelUi*Plugin.html > /tmp/babelfile.$$; mv -f /tmp/babelfile.$$ babelUi*Plugin.html");
+			exec("cd $orion_language_packs_dir_for_train$each_language_pack_dir; sed -e \"s/\[locale\]/$language_iso_web/g\" babelUsers*Plugin.html > /tmp/babelfile.$$; mv -f /tmp/babelfile.$$ babelUsers*Plugin.html");
+			exec("cd $orion_language_packs_dir_for_train$each_language_pack_dir; sed -e \"s/\[language\]/$language_name/g\" babelEditor*Plugin.html > /tmp/babelfile.$$; mv -f /tmp/babelfile.$$ babelEditor*Plugin.html");
+			exec("cd $orion_language_packs_dir_for_train$each_language_pack_dir; sed -e \"s/\[language\]/$language_name/g\" babelGit*Plugin.html > /tmp/babelfile.$$; mv -f /tmp/babelfile.$$ babelGit*Plugin.html");
+			exec("cd $orion_language_packs_dir_for_train$each_language_pack_dir; sed -e \"s/\[language\]/$language_name/g\" babelUi*Plugin.html > /tmp/babelfile.$$; mv -f /tmp/babelfile.$$ babelUi*Plugin.html");
+			exec("cd $orion_language_packs_dir_for_train$each_language_pack_dir; sed -e \"s/\[language\]/$language_name/g\" babelUsers*Plugin.html > /tmp/babelfile.$$; mv -f /tmp/babelfile.$$ babelUsers*Plugin.html");
+			exec("cd $orion_language_packs_dir_for_train$each_language_pack_dir; sed -e \"s/\[build_id\]/$build_id/g\" babelEditor*Plugin.html > /tmp/babelfile.$$; mv -f /tmp/babelfile.$$ babelEditor*Plugin.html");
+			exec("cd $orion_language_packs_dir_for_train$each_language_pack_dir; sed -e \"s/\[build_id\]/$build_id/g\" babelGit*Plugin.html > /tmp/babelfile.$$; mv -f /tmp/babelfile.$$ babelGit*Plugin.html");
+			exec("cd $orion_language_packs_dir_for_train$each_language_pack_dir; sed -e \"s/\[build_id\]/$build_id/g\" babelUi*Plugin.html > /tmp/babelfile.$$; mv -f /tmp/babelfile.$$ babelUi*Plugin.html");
+			exec("cd $orion_language_packs_dir_for_train$each_language_pack_dir; sed -e \"s/\[build_id\]/$build_id/g\" babelUsers*Plugin.html > /tmp/babelfile.$$; mv -f /tmp/babelfile.$$ babelUsers*Plugin.html");
+			/*
+			 * Copy in the Babel Pseudo Translations Index file
+			 */
+			if (strcmp($language_iso, "en_AA") == 0) {
+				$pseudo_translations_index_file = fopen($orion_language_packs_dir_for_train . $each_language_pack_dir . "BabelPseudoTranslationsIndex-$project_id.html", "w");
+				fwrite($pseudo_translations_index_file, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">" .
+					"\n<html>\n<head>\n<title>Babel Pseudo Translations Index for $project_id</title>" .
+					"\n<meta http-equiv=Content-Type content=\"text/html; charset=UTF-8\">\n</head>" .
+					"\n<body>\n\t<h1>Babel Pseudo Translations Index for $project_id</h1>" .
+					"\n\t<h2>Version: $train_version_timestamp</h2>\n\t<ul>");
+				foreach ($pseudo_translations_indexes[$project_id] as $index) {
+					fwrite($pseudo_translations_index_file, $index);
+				}
+				fwrite($pseudo_translations_index_file, "\n\t</ul>\n</div></div></body>\n</html>");
+				fclose($pseudo_translations_index_file);
+			}
+			/*
+			 * Zip up language pack
+			 */
+			$language_pack_name = "BabelLanguagePack-$project_id-${language_iso}_$train_version_timestamp.zip";
+			exec("cd $orion_language_packs_dir_for_train$each_language_pack_dir; zip -r $babel_language_packs_dir_for_train$language_pack_name *");
+			/*
+			 * Save and do not delete $orion_language_packs_dir_for_train$each_language_pack_dir
+			 */
+			/* exec("rm -rf $orion_language_packs_dir_for_train$each_language_pack_dir"); */
+		}  /* End: foreach project  */
+		echo "${leader}Completed  language pack for: $language_name ($language_iso)\n";
+	}
+
+	$dbh = $dbc->disconnect();
+	echo "Completed  language packs for: $train_id\n";
+}
+
+function usage() {
+	echo "\n";
+	echo "generate_orion.php -b <build_id> [-t <train_id>]\n";
+	echo "  -b <build_id>: The Build ID for this build\n";
+	echo "  -t <train_id>: Optional: train to build (indigo, helios, galileo, ganymede, europa)";
+	echo "\n";
+}
+
+?>
diff --git a/classes/export/import_js_translations.php b/classes/export/import_js_translations.php
new file mode 100644
index 0000000..9ea8d43
--- /dev/null
+++ b/classes/export/import_js_translations.php
@@ -0,0 +1,129 @@
+<?php
+/*******************************************************************************
+ * Copyright (c) 2013 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Kit Lo (IBM) - [402215] Extract Orion JavaScript files for translation
+ *******************************************************************************/
+
+error_reporting(E_ALL); ini_set("display_errors", true);
+
+header("Content-type: text/plain");
+include("../../html/global.php");
+InitPage("");
+
+$headless = 1;
+
+# See http://wiki.eclipse.org/Babel_/_Large_Contribution_Import_Process
+#
+# !!  IMPORTANT !!
+# Set to 1 unless the translations were authored (and tested/reviewed in context) by professionals
+# This doesn't mean all incoming translations will be fuzzy --
+# only those that are 'replacing' a non-fuzzy one
+$fuzzy = 1;
+
+require(dirname(__FILE__) . "/../file/file.class.php");
+require_once("/home/data/httpd/babel.eclipse.org/html/json_encode.php");
+
+$pageTitle = "Babel - Import Translation archive";
+$pageKeywords = "import,properties,translation,language,nlpack,pack,eclipse,babel";
+
+$USER = getGenieUser()->userid;
+
+# TODO
+$indir = "/tmp/tmp-babel/import";
+chdir($indir);
+# sub-structure: ./XX/eclipse/plugins/ where XX is the iso code for the language
+exec('find . -type f', $lines);
+		
+# loop through files
+foreach ($lines as $line) {
+	$line = trim($line);
+	# echo $line . "\n";
+	if(preg_match("/^\.\/([a-zA-Z0-9._-]+)\/([0-9.]+)\/([a-zA-Z0-9_-]+)\/(.+\.js)$/", $line, $matches)) {
+		$PROJECT_ID = $matches[1];
+		$VERSION = $matches[2];
+		$language = $matches[3];
+		$file = $matches[4];
+		
+		$file_id = 0;
+		$language_id = 0;
+		
+		$SQL = "SELECT F.file_id, L.language_id 
+		FROM files AS F, languages AS L WHERE F.is_active = 1 
+		AND F.project_id = '" . $PROJECT_ID . "' AND F.version = '" . $VERSION . "'
+			AND F.name LIKE '%" . $file . "' AND L.iso_code = '" . $language . "'";
+		$rs = mysql_query($SQL, $dbh);
+		if($myrow = mysql_fetch_assoc($rs)) {
+			$file_id 		= $myrow['file_id'];
+			$language_id 	= $myrow['language_id'];
+			# echo "  Found file: " . $file_id . "\n";
+		} 
+
+		if($file_id > 0 && $language_id > 0) {
+			# Get the file contents
+			$fh      = fopen($line, 'r');
+			$size 	 = filesize($line);
+
+			# echo $file . " - file size: " . $size . " language: " . $language . "\n";
+			$content = fread($fh, $size);
+			# echo $content . "<br/>";
+			fclose($fh);
+			$file_contents = ereg_replace("\r\n?", "\n", $content);
+			$file_contents = preg_replace("/NON-NLS-(.*)/", "", $file_contents);
+			$file_contents = preg_replace("/\\/\\/\\$/", "", $file_contents);
+			$file_contents = preg_replace("/((.*?(\n))+.*?)define\(/", "define(", $file_contents);
+			$file_contents = preg_replace("/define\(((.*?(\n))+.*?)\)\;/", "$1", $file_contents);
+			$jsons = new Services_JSON();
+			$lines = $jsons->decode($file_contents);
+			foreach($lines as $key => $value) {
+							# Get the matching string name
+							$SQL = "SELECT s.string_id, s.value, tr.value as tr_last, tr.possibly_incorrect as tr_last_fuzzy, trv.value as ever_tr_value
+							FROM strings as s
+							left join translations as tr on (s.string_id = tr.string_id
+	    					and tr.language_id = $language_id
+	    					and tr.is_active)
+	    					left join translations as trv on (s.string_id = trv.string_id
+	    					and trv.language_id = $language_id
+	    					and trv.value = '" . addslashes(unescape($value)) . "')
+							WHERE s.is_active = 1 AND s.non_translatable <> 1 AND s.file_id = " . $file_id . " AND s.name = '" . $key . "'";
+							$rs_string = mysql_query($SQL, $dbh);
+						if ($rs_string) {
+							$myrow_string = mysql_fetch_assoc($rs_string);
+							if($myrow_string['string_id'] > 0  				# There is an English string   
+								 && $value != ""							# With a non-null English value
+								 && $myrow_string['ever_tr_value'] == ""	# That's never been translated to this incoming value
+								 && $value != $myrow_string['value']  	# And the proposed translation is different from the English value
+								 ) {
+								$insert_as_fuzzy = 0;
+								if($myrow_string['tr_last'] != "" && $fuzzy == 1 && $myrow_string['tr_last_fuzzy'] == 0) {
+									# This incoming translation is replacing an existing value that is *not* marked as fuzzy
+									# And the $fuzzy == 1, so we may be replacing a known good value !!
+									$insert_as_fuzzy = 1;
+								}
+								else {
+									## Nothing. Insert as non-fuzzy.
+									## If this is replacing a fuzzy value, then that's a good thing
+								}
+								# echo "    Language: " . $language . " - Found string with ID: " . $myrow_string['string_id'] . " value: " . $myrow_string['value'] . " never translated to: " . $value . "\n";
+								$SQL = "UPDATE translations set is_active = 0 where string_id = " . $myrow_string['string_id'] . " and language_id = '" . $language_id . "'";
+								mysql_query($SQL, $dbh);
+								$SQL = "INSERT INTO translations (translation_id, string_id, language_id, version, value, possibly_incorrect, is_active, userid, created_on)
+								VALUES (
+									NULL, " . $myrow_string['string_id'] . ", 
+									" . $language_id . ", 0, '" . addslashes(unescape($value)) . "', $insert_as_fuzzy, 1, " . $USER . ", NOW()
+								)";
+								mysql_query($SQL, $dbh);
+								# echo $SQL;
+							}
+						}
+			}
+		}
+	}
+}
+echo "Done.\n\n";
+?>
diff --git a/classes/export/source_files_for_orion/babelEditorPlugin.html b/classes/export/source_files_for_orion/babelEditorPlugin.html
new file mode 100644
index 0000000..8dc7fc1
--- /dev/null
+++ b/classes/export/source_files_for_orion/babelEditorPlugin.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta name="copyright" content="Copyright (c) 2013 IBM Corporation and others.">
+	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<title>Babel Language Pack Plugin for Orion Editor in [language]</title>
+	<script type="text/javascript" src="lib/plugin.js"></script>
+	<script type="text/javascript" src="lib/require.js"></script>
+	<script>
+		window.onload = function() {
+			var headers = {
+				name: "Babel Language Pack Plugin for Orion Editor in [language]",
+				version: "[build_id]",
+				description: "Babel community translations for Orion Editor in [language]."
+			};
+			var provider = new orion.PluginProvider(headers);
+			var messages = [
+				//The list of message files
+				'orion/editor/nls/[locale]/messages'
+			];
+			
+			require({baseUrl: 'org.eclipse.orion.client.editor'});
+			
+			require(['../lib/Deferred'], function(Deferred){
+			
+				function defineMessages(msg){
+					provider.registerServiceProvider("orion.i18n.message", {
+						getMessageBundle: function() {
+						var deferred = new Deferred();
+							require([msg], function(messages){
+									deferred.resolve(messages);
+								});
+							return deferred;
+						}
+					}, {
+						name: msg
+					});
+				};
+				
+				for(var i=0; i<messages.length; i++){
+					defineMessages(messages[i]);
+				}
+				
+				provider.connect();
+			
+			});
+		};
+		
+	</script>
+</head>
+<body>
+<h1>Babel Language Pack Plugin for Orion Editor in [language]</h1>
+<h2>Build ID: [build_id]</h2>
+<p>This Babel language pack plugin is based on the community translations entered into the <a href='http://babel.eclipse.org/'>Babel Translation Tool</a>, and may not be complete or entirely accurate.
+If you find missing or incorrect translations, please use the <a href='http://babel.eclipse.org/'>Babel Translation Tool</a> to update them.
+All downloads are provided under the terms and conditions of the <a href='http://www.eclipse.org/legal/epl/notice.php'>Eclipse Foundation Software User Agreement</a> unless otherwise specified.</p>
+<h2>Installation</h2>
+<p>See <a href='http://wiki.eclipse.org/Orion/How_Tos/Installing_A_Plugin'>Installing A Plugin</a> for instructions on how to install this Babel language pack plugin.</p>
+</body>
+</html>
diff --git a/classes/export/source_files_for_orion/babelGitPlugin.html b/classes/export/source_files_for_orion/babelGitPlugin.html
new file mode 100644
index 0000000..cca418a
--- /dev/null
+++ b/classes/export/source_files_for_orion/babelGitPlugin.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta name="copyright" content="Copyright (c) 2013 IBM Corporation and others.">
+	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<title>Babel Language Pack Plugin for Orion Git in [language]</title>
+	<script type="text/javascript" src="lib/plugin.js"></script>
+	<script type="text/javascript" src="lib/require.js"></script>
+	<script>
+		window.onload = function() {
+			var headers = {
+				name: "Babel Language Pack Plugin for Orion Git in [language]",
+				version: "[build_id]",
+				description: "Babel community translations for Orion Git in [language]."
+			};
+			var provider = new orion.PluginProvider(headers);
+			var messages = [
+				//The list of message files
+				'git/nls/[locale]/gitmessages'
+			];
+			
+			require({baseUrl: 'org.eclipse.orion.client.git'});
+			
+			require(['../lib/Deferred'], function(Deferred){
+			
+				function defineMessages(msg){
+					provider.registerServiceProvider("orion.i18n.message", {
+						getMessageBundle: function() {
+						var deferred = new Deferred();
+							require([msg], function(messages){
+									deferred.resolve(messages);
+								});
+							return deferred;
+						}
+					}, {
+						name: msg
+					});
+				};
+				
+				for(var i=0; i<messages.length; i++){
+					defineMessages(messages[i]);
+				}
+				
+				provider.connect();
+			
+			});
+		};
+		
+	</script>
+</head>
+<body>
+<h1>Babel Language Pack Plugin for Orion Git in [language]</h1>
+<h2>Build ID: [build_id]</h2>
+<p>This Babel language pack plugin is based on the community translations entered into the <a href='http://babel.eclipse.org/'>Babel Translation Tool</a>, and may not be complete or entirely accurate.
+If you find missing or incorrect translations, please use the <a href='http://babel.eclipse.org/'>Babel Translation Tool</a> to update them.
+All downloads are provided under the terms and conditions of the <a href='http://www.eclipse.org/legal/epl/notice.php'>Eclipse Foundation Software User Agreement</a> unless otherwise specified.</p>
+<h2>Installation</h2>
+<p>See <a href='http://wiki.eclipse.org/Orion/How_Tos/Installing_A_Plugin'>Installing A Plugin</a> for instructions on how to install this Babel language pack plugin.</p>
+</body>
+</html>
diff --git a/classes/export/source_files_for_orion/babelUiPlugin.html b/classes/export/source_files_for_orion/babelUiPlugin.html
new file mode 100644
index 0000000..acff2ec
--- /dev/null
+++ b/classes/export/source_files_for_orion/babelUiPlugin.html
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta name="copyright" content="Copyright (c) 2013 IBM Corporation and others.">
+	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<title>Babel Language Pack Plugin for Orion UI in [language]</title>
+	<script type="text/javascript" src="lib/plugin.js"></script>
+	<script type="text/javascript" src="lib/require.js"></script>
+	<script>
+		window.onload = function() {
+			var headers = {
+				name: "Babel Language Pack Plugin for Orion UI in [language]",
+				version: "[build_id]",
+				description: "Babel community translations for Orion UI in [language]."
+			};
+			var provider = new orion.PluginProvider(headers);
+			var messages = [
+				//The list of message files
+				'orion/compare/nls/[locale]/messages',
+				'orion/content/nls/[locale]/messages',
+				'orion/crawler/nls/[locale]/messages',
+				'orion/edit/nls/[locale]/messages',
+				'orion/globalSearch/nls/[locale]/messages',
+				'orion/navigate/nls/[locale]/messages',
+				'orion/nls/[locale]/messages',
+				'orion/operations/nls/[locale]/messages',
+				'orion/search/nls/[locale]/messages',
+				'orion/settings/nls/[locale]/messages',
+				'orion/shell/[locale]/messages',
+				'orion/sites/nls/[locale]/messages',
+				'orion/stringexternalizer/nls/[locale]/messages',
+				'orion/widgets/nls/[locale]/messages'
+			];
+			
+			require({baseUrl: 'org.eclipse.orion.client.ui'});
+			
+			require(['../lib/Deferred'], function(Deferred){
+			
+				function defineMessages(msg){
+					provider.registerServiceProvider("orion.i18n.message", {
+						getMessageBundle: function() {
+						var deferred = new Deferred();
+							require([msg], function(messages){
+									deferred.resolve(messages);
+								});
+							return deferred;
+						}
+					}, {
+						name: msg
+					});
+				};
+				
+				for(var i=0; i<messages.length; i++){
+					defineMessages(messages[i]);
+				}
+				
+				provider.connect();
+			
+			});
+		};
+		
+	</script>
+</head>
+<body>
+<h1>Babel Language Pack Plugin for Orion UI in [language]</h1>
+<h2>Build ID: [build_id]</h2>
+<p>This Babel language pack plugin is based on the community translations entered into the <a href='http://babel.eclipse.org/'>Babel Translation Tool</a>, and may not be complete or entirely accurate.
+If you find missing or incorrect translations, please use the <a href='http://babel.eclipse.org/'>Babel Translation Tool</a> to update them.
+All downloads are provided under the terms and conditions of the <a href='http://www.eclipse.org/legal/epl/notice.php'>Eclipse Foundation Software User Agreement</a> unless otherwise specified.</p>
+<h2>Installation</h2>
+<p>See <a href='http://wiki.eclipse.org/Orion/How_Tos/Installing_A_Plugin'>Installing A Plugin</a> for instructions on how to install this Babel language pack plugin.</p>
+</body>
+</html>
diff --git a/classes/export/source_files_for_orion/babelUsersPlugin.html b/classes/export/source_files_for_orion/babelUsersPlugin.html
new file mode 100644
index 0000000..e094a64
--- /dev/null
+++ b/classes/export/source_files_for_orion/babelUsersPlugin.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta name="copyright" content="Copyright (c) 2013 IBM Corporation and others.">
+	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<title>Babel Language Pack Plugin for Orion Users in [language]</title>
+	<script type="text/javascript" src="lib/plugin.js"></script>
+	<script type="text/javascript" src="lib/require.js"></script>
+	<script>
+		window.onload = function() {
+			var headers = {
+				name: "Babel Language Pack Plugin for Orion Users in [language]",
+				version: "[build_id]",
+				description: "Babel community translations for Orion Users in [language]."
+			};
+			var provider = new orion.PluginProvider(headers);
+			var messages = [
+				//The list of message files
+				'profile/nls/[locale]/messages'
+			];
+			
+			require({baseUrl: 'org.eclipse.orion.client.users'});
+			
+			require(['../lib/Deferred'], function(Deferred){
+			
+				function defineMessages(msg){
+					provider.registerServiceProvider("orion.i18n.message", {
+						getMessageBundle: function() {
+						var deferred = new Deferred();
+							require([msg], function(messages){
+									deferred.resolve(messages);
+								});
+							return deferred;
+						}
+					}, {
+						name: msg
+					});
+				};
+				
+				for(var i=0; i<messages.length; i++){
+					defineMessages(messages[i]);
+				}
+				
+				provider.connect();
+			
+			});
+		};
+		
+	</script>
+</head>
+<body>
+<h1>Babel Language Pack Plugin for Orion Users in [language]</h1>
+<h2>Build ID: [build_id]</h2>
+<p>This Babel language pack plugin is based on the community translations entered into the <a href='http://babel.eclipse.org/'>Babel Translation Tool</a>, and may not be complete or entirely accurate.
+If you find missing or incorrect translations, please use the <a href='http://babel.eclipse.org/'>Babel Translation Tool</a> to update them.
+All downloads are provided under the terms and conditions of the <a href='http://www.eclipse.org/legal/epl/notice.php'>Eclipse Foundation Software User Agreement</a> unless otherwise specified.</p>
+<h2>Installation</h2>
+<p>See <a href='http://wiki.eclipse.org/Orion/How_Tos/Installing_A_Plugin'>Installing A Plugin</a> for instructions on how to install this Babel language pack plugin.</p>
+</body>
+</html>
diff --git a/classes/export/source_files_for_orion/lib/Deferred.js b/classes/export/source_files_for_orion/lib/Deferred.js
new file mode 100644
index 0000000..1a2026c
--- /dev/null
+++ b/classes/export/source_files_for_orion/lib/Deferred.js
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * @license
+ * Copyright (c) 2013 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials are made 
+ * available under the terms of the Eclipse Public License v1.0 
+ * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
+ * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
+ *
+ * Contributors:
+ *    IBM Corporation - initial API and implementation
+ *******************************************************************************/
+/*global define*/
+
+(function() {
+	var global = this;
+	if (!global.define) {
+		global.define = function(f) {
+			global.orion = global.orion || {};
+			global.orion.Deferred = f();
+			delete global.define;
+		};
+	}
+}());
+
+define(function() {
+	var head, tail, remainingHead, remainingTail, running = false;
+
+	function queueNotification(notify) {
+		if (running) {
+			if (!head) {
+				head = {
+					notify: notify,
+					next: null
+				};
+				tail = head;
+			} else {
+				tail.next = {
+					notify: notify,
+					next: null
+				};
+				tail = tail.next;
+			}
+			return;
+		}
+		running = true;
+		do {
+			while (notify) {
+				notify();
+				if (remainingHead) {
+					if (!head) {
+						head = remainingHead;
+					} else {
+						tail.next = remainingHead;
+					}
+					tail = remainingTail;
+				}
+				if (head) {
+					remainingHead = head.next;
+					remainingTail = tail;
+					notify = head.notify;
+					head = tail = null;
+				} else {
+					notify = null;
+				}
+			}
+			running = false;
+		} while (running);
+	}
+
+	function Deferred() {
+		var result, state, head, tail;
+
+		function notify() {
+			while (head) {
+				var listener = head;
+				head = head.next;
+				var deferred = listener.deferred;
+				if (listener[state]) {
+					try {
+						var listenerResult = listener[state](result);
+						if (listenerResult && typeof listenerResult.then === "function") {
+							listenerResult.then(deferred.resolve, deferred.reject, deferred.update);
+							continue;
+						}
+						deferred.resolve(listenerResult);
+					} catch (e) {
+						deferred.reject(e);
+					}
+				} else {
+					deferred[state](result);
+				}
+			}
+			head = tail = null;
+		}
+
+		this.resolve = function(value) {
+			if (state) {
+				throw new Error("'" + state + "' already called");
+			}
+			state = "resolve";
+			result = value;
+			queueNotification(notify);
+		};
+
+		this.reject = function(error) {
+			if (state) {
+				throw new Error("'" + state + "' already called");
+			}
+			state = "reject";
+			result = error;
+			queueNotification(notify);
+		};
+
+		this.update = this.progress = this.notify = function(progress) {
+			var listener = head;
+			while (listener) {
+				if (listener.update) {
+					try {
+						listener.update(progress);
+					} catch (e) {}
+				}
+				listener = listener.next;
+			}
+		};
+
+		this.then = function(onResolve, onReject, onUpdate) {
+			var listener = {
+				resolve: onResolve,
+				reject: onReject,
+				update: onUpdate,
+				deferred: new Deferred()
+			};
+			if (head) {
+				tail.next = listener;
+			} else {
+				head = listener;
+			}
+			tail = listener;
+			if (state) {
+				queueNotification(notify);
+			}
+			return listener.deferred.promise;
+		};
+
+		this.promise = {
+			then: this.then
+		};
+
+		this.state = function() {
+			return state || "wait";
+		};
+		
+		this.all = function(promises, optOnError) {
+			var count = promises.length, result = [], deferred = this;
+
+			function onResolve(i, value) {
+				if (!state) {
+					result[i] = value;
+					if (--count === 0) {
+						deferred.resolve(result);
+					}
+				}
+			}
+			
+			function onReject(i, error) {
+				if (!state) {
+					if (optOnError) {
+						try {
+							onResolve(i, optOnError(error)); 
+							return;
+						} catch (e) {
+							error = e;
+						}
+					}
+					deferred.reject(error);
+				}
+			}
+			
+			if (count === 0) {
+				this.resolve(result);
+			} else {
+				promises.forEach(function(promise, i) {
+					promise.then(onResolve.bind(null, i), onReject.bind(null, i));
+				});
+			}
+			return this.promise;
+		};
+	}
+	Deferred.when = function(value, onResolve, onReject, onUpdate) {
+		var promise, deferred;
+		if (value && typeof value.then === "function") {
+			promise = value;
+		} else {
+			deferred = new Deferred();
+			deferred.resolve(value);
+			promise = deferred.promise;
+		}
+		return promise.then(onResolve, onReject, onUpdate);
+	};
+	return Deferred;
+});
\ No newline at end of file
diff --git a/classes/export/source_files_for_orion/lib/plugin.js b/classes/export/source_files_for_orion/lib/plugin.js
new file mode 100644
index 0000000..15ad200
--- /dev/null
+++ b/classes/export/source_files_for_orion/lib/plugin.js
@@ -0,0 +1,244 @@
+/*******************************************************************************
+ * @license
+ * Copyright (c) 2013 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials are made 
+ * available under the terms of the Eclipse Public License v1.0 
+ * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
+ * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
+ *
+ * Contributors:
+ *    IBM Corporation - initial API and implementation
+ *******************************************************************************/
+/*global window ArrayBuffer addEventListener removeEventListener self XMLHttpRequest define*/
+
+(function() {
+	var global = this;
+	if (!global.define) {
+		global.define = function(f) {
+			global.orion = global.orion || {};
+			global.orion.PluginProvider = f();
+			global.eclipse = global.orion; // (deprecated) backward compatibility 
+			delete global.define;
+		};
+	}
+}());
+
+define(function() {
+	function PluginProvider(headers) {
+		var _headers = headers;
+		var _services = [];
+		var _connected = false;
+		var _activePromises = {};
+		var _target = null;
+
+		function _publish(message) {
+			if (_target) {
+				if (typeof(ArrayBuffer) === "undefined") { //$NON-NLS-0$
+					message = JSON.stringify(message);
+				}
+				if (_target === self) {
+					_target.postMessage(message);
+				} else {
+					_target.postMessage(message, "*"); //$NON-NLS-0$
+				}
+			}
+		}
+
+		function _getPluginData() {
+			var services = [];
+			// we filter out the service implementation from the data
+			for (var i = 0; i < _services.length; i++) {
+				services.push({
+					serviceId: i,
+					names: _services[i].names,
+					methods: _services[i].methods,
+					properties: _services[i].properties
+				});
+			}
+			return {
+				headers: _headers || {},
+				services: services
+			};
+		}
+
+		function _jsonXMLHttpRequestReplacer(name, value) {
+			if (value && value instanceof XMLHttpRequest) {
+				return {
+					status: value.status,
+					statusText: value.statusText
+				};
+			}
+			return value;
+		}
+
+		function _serializeError(error) {
+			var result = error ? JSON.parse(JSON.stringify(error, _jsonXMLHttpRequestReplacer)) : error; // sanitizing Error object
+			if (error instanceof Error) {
+				result.__isError = true;
+				result.message = result.message || error.message;
+				result.name = result.name || error.name;
+			}
+			return result;
+		}
+
+		function _createListener(serviceId) {
+			return function(event) {
+				if (_connected) {
+					var message = {
+						serviceId: serviceId,
+						method: "dispatchEvent", //$NON-NLS-0$
+						params: [event]
+					};
+					_publish(message);
+				}
+			};
+		}
+
+		function _handleRequest(event) {
+			if (event.source !== _target) {
+				return;
+			}
+			var message = (typeof event.data !== "string" ? event.data : JSON.parse(event.data)); //$NON-NLS-0$
+			if (typeof message.cancel === "string") {
+				var promise = _activePromises[message.id];
+				if (promise) {
+					delete _activePromises[message.id];
+					if (promise.cancel) {
+						promise.cancel(message.cancel);
+					}
+				}
+				return;
+			}
+			var serviceId = message.serviceId;
+			var methodName = message.method;
+			var params = message.params;
+			var service = _services[serviceId];
+			var implementation = service.implementation;
+			var method = implementation[methodName];
+
+			var type;
+			if (methodName === "addEventListener") {
+				type = params[0];
+				service.listeners[type] = service.listeners[type] || _createListener(serviceId);
+				params = [type, service.listeners[type]];
+			} else if (methodName === "removeEventListener") {
+				type = params[0];
+				params = [type, service.listeners[type]];
+				delete service.listeners[type];
+			}
+
+			var response = {
+				id: message.id,
+				result: null,
+				error: null
+			};
+			try {
+				var promiseOrResult = method.apply(implementation, params);
+				if (promiseOrResult && typeof promiseOrResult.then === "function") { //$NON-NLS-0$
+					_activePromises[message.id] = promiseOrResult;
+					promiseOrResult.then(function(result) {
+						delete _activePromises[message.id];
+						response.result = result;
+						_publish(response);
+					}, function(error) {
+						if (_activePromises[message.id]) {
+							delete _activePromises[message.id];
+							response.error = _serializeError(error);
+							_publish(response);
+						}
+					}, function() {
+						_publish({
+							requestId: message.id,
+							method: "progress",
+							params: Array.prototype.slice.call(arguments)
+						}); //$NON-NLS-0$
+					});
+				} else {
+					response.result = promiseOrResult;
+					_publish(response);
+				}
+			} catch (error) {
+				response.error = _serializeError(error);
+				_publish(response);
+			}
+		}
+
+		this.updateHeaders = function(headers) {
+			if (_connected) {
+				throw new Error("Cannot update headers. Plugin Provider is connected");
+			}
+			_headers = headers;
+		};
+
+		this.registerService = function(names, implementation, properties) {
+			if (_connected) {
+				throw new Error("Cannot register service. Plugin Provider is connected");
+			}
+
+			if (typeof names === "string") {
+				names = [names];
+			} else if (!Array.isArray(names)) {
+				names = [];
+			}
+
+			var method = null;
+			var methods = [];
+			for (method in implementation) {
+				if (typeof implementation[method] === 'function') { //$NON-NLS-0$
+					methods.push(method);
+				}
+			}
+			var serviceId = _services.length;
+			_services[serviceId] = {
+				names: names,
+				methods: methods,
+				implementation: implementation,
+				properties: properties || {},
+				listeners: {}
+			};
+		};
+		this.registerServiceProvider = this.registerService; // (deprecated) backwards compatibility only
+
+		this.connect = function(callback, errback) {
+			if (_connected) {
+				if (callback) {
+					callback();
+				}
+				return;
+			}
+
+			if (typeof(window) === "undefined") { //$NON-NLS-0$
+				_target = self;
+			} else if (window !== window.parent) {
+				_target = window.parent;
+			} else if (window.opener !== null) {
+				_target = window.opener;
+			} else {
+				if (errback) {
+					errback("No valid plugin target");
+				}
+				return;
+			}
+			addEventListener("message", _handleRequest, false); //$NON-NLS-0$
+			var message = {
+				method: "plugin", //$NON-NLS-0$
+				params: [_getPluginData()]
+			};
+			_publish(message);
+			_connected = true;
+			if (callback) {
+				callback();
+			}
+		};
+
+		this.disconnect = function() {
+			if (_connected) {
+				removeEventListener("message", _handleRequest); //$NON-NLS-0$
+				_target = null;
+				_connected = false;
+			}
+			// Note: re-connecting is not currently supported
+		};
+	}
+	return PluginProvider;
+});
\ No newline at end of file
diff --git a/classes/export/source_files_for_orion/lib/require.js b/classes/export/source_files_for_orion/lib/require.js
new file mode 100644
index 0000000..9d010cb
--- /dev/null
+++ b/classes/export/source_files_for_orion/lib/require.js
@@ -0,0 +1,2053 @@
+/** vim: et:ts=4:sw=4:sts=4
+ * @license RequireJS 1.0.7 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
+ * Available via the MIT or new BSD license.
+ * see: http://github.com/jrburke/requirejs for details
+ */
+/*jslint strict: false, plusplus: false, sub: true */
+/*global window, navigator, document, importScripts, jQuery, setTimeout, opera */
+
+var requirejs, require, define;
+(function () {
+    //Change this version number for each release.
+    var version = "1.0.7",
+        commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
+        cjsRequireRegExp = /require\(\s*["']([^'"\s]+)["']\s*\)/g,
+        currDirRegExp = /^\.\//,
+        jsSuffixRegExp = /\.js$/,
+        ostring = Object.prototype.toString,
+        ap = Array.prototype,
+        aps = ap.slice,
+        apsp = ap.splice,
+        isBrowser = !!(typeof window !== "undefined" && navigator && document),
+        isWebWorker = !isBrowser && typeof importScripts !== "undefined",
+        //PS3 indicates loaded and complete, but need to wait for complete
+        //specifically. Sequence is "loading", "loaded", execution,
+        // then "complete". The UA check is unfortunate, but not sure how
+        //to feature test w/o causing perf issues.
+        readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
+                      /^complete$/ : /^(complete|loaded)$/,
+        defContextName = "_",
+        //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
+        isOpera = typeof opera !== "undefined" && opera.toString() === "[object Opera]",
+        empty = {},
+        contexts = {},
+        globalDefQueue = [],
+        interactiveScript = null,
+        checkLoadedDepth = 0,
+        useInteractive = false,
+        reservedDependencies = {
+            require: true,
+            module: true,
+            exports: true
+        },
+        req, cfg = {}, currentlyAddingScript, s, head, baseElement, scripts, script,
+        src, subPath, mainScript, dataMain, globalI, ctx, jQueryCheck, checkLoadedTimeoutId;
+
+    function isFunction(it) {
+        return ostring.call(it) === "[object Function]";
+    }
+
+    function isArray(it) {
+        return ostring.call(it) === "[object Array]";
+    }
+
+    /**
+     * Simple function to mix in properties from source into target,
+     * but only if target does not already have a property of the same name.
+     * This is not robust in IE for transferring methods that match
+     * Object.prototype names, but the uses of mixin here seem unlikely to
+     * trigger a problem related to that.
+     */
+    function mixin(target, source, force) {
+        for (var prop in source) {
+            if (!(prop in empty) && (!(prop in target) || force)) {
+                target[prop] = source[prop];
+            }
+        }
+        return req;
+    }
+
+    /**
+     * Constructs an error with a pointer to an URL with more information.
+     * @param {String} id the error ID that maps to an ID on a web page.
+     * @param {String} message human readable error.
+     * @param {Error} [err] the original error, if there is one.
+     *
+     * @returns {Error}
+     */
+    function makeError(id, msg, err) {
+        var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
+        if (err) {
+            e.originalError = err;
+        }
+        return e;
+    }
+
+    /**
+     * Used to set up package paths from a packagePaths or packages config object.
+     * @param {Object} pkgs the object to store the new package config
+     * @param {Array} currentPackages an array of packages to configure
+     * @param {String} [dir] a prefix dir to use.
+     */
+    function configurePackageDir(pkgs, currentPackages, dir) {
+        var i, location, pkgObj;
+
+        for (i = 0; (pkgObj = currentPackages[i]); i++) {
+            pkgObj = typeof pkgObj === "string" ? { name: pkgObj } : pkgObj;
+            location = pkgObj.location;
+
+            //Add dir to the path, but avoid paths that start with a slash
+            //or have a colon (indicates a protocol)
+            if (dir && (!location || (location.indexOf("/") !== 0 && location.indexOf(":") === -1))) {
+                location = dir + "/" + (location || pkgObj.name);
+            }
+
+            //Create a brand new object on pkgs, since currentPackages can
+            //be passed in again, and config.pkgs is the internal transformed
+            //state for all package configs.
+            pkgs[pkgObj.name] = {
+                name: pkgObj.name,
+                location: location || pkgObj.name,
+                //Remove leading dot in main, so main paths are normalized,
+                //and remove any trailing .js, since different package
+                //envs have different conventions: some use a module name,
+                //some use a file name.
+                main: (pkgObj.main || "main")
+                      .replace(currDirRegExp, '')
+                      .replace(jsSuffixRegExp, '')
+            };
+        }
+    }
+
+    /**
+     * jQuery 1.4.3-1.5.x use a readyWait/ready() pairing to hold DOM
+     * ready callbacks, but jQuery 1.6 supports a holdReady() API instead.
+     * At some point remove the readyWait/ready() support and just stick
+     * with using holdReady.
+     */
+    function jQueryHoldReady($, shouldHold) {
+        if ($.holdReady) {
+            $.holdReady(shouldHold);
+        } else if (shouldHold) {
+            $.readyWait += 1;
+        } else {
+            $.ready(true);
+        }
+    }
+
+    if (typeof define !== "undefined") {
+        //If a define is already in play via another AMD loader,
+        //do not overwrite.
+        return;
+    }
+
+    if (typeof requirejs !== "undefined") {
+        if (isFunction(requirejs)) {
+            //Do not overwrite and existing requirejs instance.
+            return;
+        } else {
+            cfg = requirejs;
+            requirejs = undefined;
+        }
+    }
+
+    //Allow for a require config object
+    if (typeof require !== "undefined" && !isFunction(require)) {
+        //assume it is a config object.
+        cfg = require;
+        require = undefined;
+    }
+
+    /**
+     * Creates a new context for use in require and define calls.
+     * Handle most of the heavy lifting. Do not want to use an object
+     * with prototype here to avoid using "this" in require, in case it
+     * needs to be used in more super secure envs that do not want this.
+     * Also there should not be that many contexts in the page. Usually just
+     * one for the default context, but could be extra for multiversion cases
+     * or if a package needs a special context for a dependency that conflicts
+     * with the standard context.
+     */
+    function newContext(contextName) {
+        var context, resume,
+            config = {
+                waitSeconds: 7,
+                baseUrl: "./",
+                paths: {},
+                pkgs: {},
+                catchError: {}
+            },
+            defQueue = [],
+            specified = {
+                "require": true,
+                "exports": true,
+                "module": true
+            },
+            urlMap = {},
+            defined = {},
+            loaded = {},
+            waiting = {},
+            waitAry = [],
+            urlFetched = {},
+            managerCounter = 0,
+            managerCallbacks = {},
+            plugins = {},
+            //Used to indicate which modules in a build scenario
+            //need to be full executed.
+            needFullExec = {},
+            fullExec = {},
+            resumeDepth = 0;
+
+        /**
+         * Trims the . and .. from an array of path segments.
+         * It will keep a leading path segment if a .. will become
+         * the first path segment, to help with module name lookups,
+         * which act like paths, but can be remapped. But the end result,
+         * all paths that use this function should look normalized.
+         * NOTE: this method MODIFIES the input array.
+         * @param {Array} ary the array of path segments.
+         */
+        function trimDots(ary) {
+            var i, part;
+            for (i = 0; (part = ary[i]); i++) {
+                if (part === ".") {
+                    ary.splice(i, 1);
+                    i -= 1;
+                } else if (part === "..") {
+                    if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
+                        //End of the line. Keep at least one non-dot
+                        //path segment at the front so it can be mapped
+                        //correctly to disk. Otherwise, there is likely
+                        //no path mapping for a path starting with '..'.
+                        //This can still fail, but catches the most reasonable
+                        //uses of ..
+                        break;
+                    } else if (i > 0) {
+                        ary.splice(i - 1, 2);
+                        i -= 2;
+                    }
+                }
+            }
+        }
+
+        /**
+         * Given a relative module name, like ./something, normalize it to
+         * a real name that can be mapped to a path.
+         * @param {String} name the relative name
+         * @param {String} baseName a real name that the name arg is relative
+         * to.
+         * @returns {String} normalized name
+         */
+        function normalize(name, baseName) {
+            var pkgName, pkgConfig;
+
+            //Adjust any relative paths.
+            if (name && name.charAt(0) === ".") {
+                //If have a base name, try to normalize against it,
+                //otherwise, assume it is a top-level require that will
+                //be relative to baseUrl in the end.
+                if (baseName) {
+                    if (config.pkgs[baseName]) {
+                        //If the baseName is a package name, then just treat it as one
+                        //name to concat the name with.
+                        baseName = [baseName];
+                    } else {
+                        //Convert baseName to array, and lop off the last part,
+                        //so that . matches that "directory" and not name of the baseName's
+                        //module. For instance, baseName of "one/two/three", maps to
+                        //"one/two/three.js", but we want the directory, "one/two" for
+                        //this normalization.
+                        baseName = baseName.split("/");
+                        baseName = baseName.slice(0, baseName.length - 1);
+                    }
+
+                    name = baseName.concat(name.split("/"));
+                    trimDots(name);
+
+                    //Some use of packages may use a . path to reference the
+                    //"main" module name, so normalize for that.
+                    pkgConfig = config.pkgs[(pkgName = name[0])];
+                    name = name.join("/");
+                    if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
+                        name = pkgName;
+                    }
+                } else if (name.indexOf("./") === 0) {
+                    // No baseName, so this is ID is resolved relative
+                    // to baseUrl, pull off the leading dot.
+                    name = name.substring(2);
+                }
+            }
+            return name;
+        }
+
+        /**
+         * Creates a module mapping that includes plugin prefix, module
+         * name, and path. If parentModuleMap is provided it will
+         * also normalize the name via require.normalize()
+         *
+         * @param {String} name the module name
+         * @param {String} [parentModuleMap] parent module map
+         * for the module name, used to resolve relative names.
+         *
+         * @returns {Object}
+         */
+        function makeModuleMap(name, parentModuleMap) {
+            var index = name ? name.indexOf("!") : -1,
+                prefix = null,
+                parentName = parentModuleMap ? parentModuleMap.name : null,
+                originalName = name,
+                normalizedName, url, pluginModule;
+
+            if (index !== -1) {
+                prefix = name.substring(0, index);
+                name = name.substring(index + 1, name.length);
+            }
+
+            if (prefix) {
+                prefix = normalize(prefix, parentName);
+            }
+
+            //Account for relative paths if there is a base name.
+            if (name) {
+                if (prefix) {
+                    pluginModule = defined[prefix];
+                    if (pluginModule && pluginModule.normalize) {
+                        //Plugin is loaded, use its normalize method.
+                        normalizedName = pluginModule.normalize(name, function (name) {
+                            return normalize(name, parentName);
+                        });
+                    } else {
+                        normalizedName = normalize(name, parentName);
+                    }
+                } else {
+                    //A regular module.
+                    normalizedName = normalize(name, parentName);
+
+                    url = urlMap[normalizedName];
+                    if (!url) {
+                        //Calculate url for the module, if it has a name.
+                        //Use name here since nameToUrl also calls normalize,
+                        //and for relative names that are outside the baseUrl
+                        //this causes havoc. Was thinking of just removing
+                        //parentModuleMap to avoid extra normalization, but
+                        //normalize() still does a dot removal because of
+                        //issue #142, so just pass in name here and redo
+                        //the normalization. Paths outside baseUrl are just
+                        //messy to support.
+                        url = context.nameToUrl(name, null, parentModuleMap);
+
+                        //Store the URL mapping for later.
+                        urlMap[normalizedName] = url;
+                    }
+                }
+            }
+
+            return {
+                prefix: prefix,
+                name: normalizedName,
+                parentMap: parentModuleMap,
+                url: url,
+                originalName: originalName,
+                fullName: prefix ? prefix + "!" + (normalizedName || '') : normalizedName
+            };
+        }
+
+        /**
+         * Determine if priority loading is done. If so clear the priorityWait
+         */
+        function isPriorityDone() {
+            var priorityDone = true,
+                priorityWait = config.priorityWait,
+                priorityName, i;
+            if (priorityWait) {
+                for (i = 0; (priorityName = priorityWait[i]); i++) {
+                    if (!loaded[priorityName]) {
+                        priorityDone = false;
+                        break;
+                    }
+                }
+                if (priorityDone) {
+                    delete config.priorityWait;
+                }
+            }
+            return priorityDone;
+        }
+
+        function makeContextModuleFunc(func, relModuleMap, enableBuildCallback) {
+            return function () {
+                //A version of a require function that passes a moduleName
+                //value for items that may need to
+                //look up paths relative to the moduleName
+                var args = aps.call(arguments, 0), lastArg;
+                if (enableBuildCallback &&
+                    isFunction((lastArg = args[args.length - 1]))) {
+                    lastArg.__requireJsBuild = true;
+                }
+                args.push(relModuleMap);
+                return func.apply(null, args);
+            };
+        }
+
+        /**
+         * Helper function that creates a require function object to give to
+         * modules that ask for it as a dependency. It needs to be specific
+         * per module because of the implication of path mappings that may
+         * need to be relative to the module name.
+         */
+        function makeRequire(relModuleMap, enableBuildCallback, altRequire) {
+            var modRequire = makeContextModuleFunc(altRequire || context.require, relModuleMap, enableBuildCallback);
+
+            mixin(modRequire, {
+                nameToUrl: makeContextModuleFunc(context.nameToUrl, relModuleMap),
+                toUrl: makeContextModuleFunc(context.toUrl, relModuleMap),
+                defined: makeContextModuleFunc(context.requireDefined, relModuleMap),
+                specified: makeContextModuleFunc(context.requireSpecified, relModuleMap),
+                isBrowser: req.isBrowser
+            });
+            return modRequire;
+        }
+
+        /*
+         * Queues a dependency for checking after the loader is out of a
+         * "paused" state, for example while a script file is being loaded
+         * in the browser, where it may have many modules defined in it.
+         */
+        function queueDependency(manager) {
+            context.paused.push(manager);
+        }
+
+        function execManager(manager) {
+            var i, ret, err, errFile, errModuleTree,
+                cb = manager.callback,
+                map = manager.map,
+                fullName = map.fullName,
+                args = manager.deps,
+                listeners = manager.listeners,
+                cjsModule;
+
+            //Call the callback to define the module, if necessary.
+            if (cb && isFunction(cb)) {
+                if (config.catchError.define) {
+                    try {
+                        ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
+                    } catch (e) {
+                        err = e;
+                    }
+                } else {
+                    ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
+                }
+
+                if (fullName) {
+                    //If setting exports via "module" is in play,
+                    //favor that over return value and exports. After that,
+                    //favor a non-undefined return value over exports use.
+                    cjsModule = manager.cjsModule;
+                    if (cjsModule &&
+                        cjsModule.exports !== undefined &&
+                        //Make sure it is not already the exports value
+                        cjsModule.exports !== defined[fullName]) {
+                        ret = defined[fullName] = manager.cjsModule.exports;
+                    } else if (ret === undefined && manager.usingExports) {
+                        //exports already set the defined value.
+                        ret = defined[fullName];
+                    } else {
+                        //Use the return value from the function.
+                        defined[fullName] = ret;
+                        //If this module needed full execution in a build
+                        //environment, mark that now.
+                        if (needFullExec[fullName]) {
+                            fullExec[fullName] = true;
+                        }
+                    }
+                }
+            } else if (fullName) {
+                //May just be an object definition for the module. Only
+                //worry about defining if have a module name.
+                ret = defined[fullName] = cb;
+
+                //If this module needed full execution in a build
+                //environment, mark that now.
+                if (needFullExec[fullName]) {
+                    fullExec[fullName] = true;
+                }
+            }
+
+            //Clean up waiting. Do this before error calls, and before
+            //calling back listeners, so that bookkeeping is correct
+            //in the event of an error and error is reported in correct order,
+            //since the listeners will likely have errors if the
+            //onError function does not throw.
+            if (waiting[manager.id]) {
+                delete waiting[manager.id];
+                manager.isDone = true;
+                context.waitCount -= 1;
+                if (context.waitCount === 0) {
+                    //Clear the wait array used for cycles.
+                    waitAry = [];
+                }
+            }
+
+            //Do not need to track manager callback now that it is defined.
+            delete managerCallbacks[fullName];
+
+            //Allow instrumentation like the optimizer to know the order
+            //of modules executed and their dependencies.
+            if (req.onResourceLoad && !manager.placeholder) {
+                req.onResourceLoad(context, map, manager.depArray);
+            }
+
+            if (err) {
+                errFile = (fullName ? makeModuleMap(fullName).url : '') ||
+                           err.fileName || err.sourceURL;
+                errModuleTree = err.moduleTree;
+                err = makeError('defineerror', 'Error evaluating ' +
+                                'module "' + fullName + '" at location "' +
+                                errFile + '":\n' +
+                                err + '\nfileName:' + errFile +
+                                '\nlineNumber: ' + (err.lineNumber || err.line), err);
+                err.moduleName = fullName;
+                err.moduleTree = errModuleTree;
+                return req.onError(err);
+            }
+
+            //Let listeners know of this manager's value.
+            for (i = 0; (cb = listeners[i]); i++) {
+                cb(ret);
+            }
+
+            return undefined;
+        }
+
+        /**
+         * Helper that creates a callack function that is called when a dependency
+         * is ready, and sets the i-th dependency for the manager as the
+         * value passed to the callback generated by this function.
+         */
+        function makeArgCallback(manager, i) {
+            return function (value) {
+                //Only do the work if it has not been done
+                //already for a dependency. Cycle breaking
+                //logic in forceExec could mean this function
+                //is called more than once for a given dependency.
+                if (!manager.depDone[i]) {
+                    manager.depDone[i] = true;
+                    manager.deps[i] = value;
+                    manager.depCount -= 1;
+                    if (!manager.depCount) {
+                        //All done, execute!
+                        execManager(manager);
+                    }
+                }
+            };
+        }
+
+        function callPlugin(pluginName, depManager) {
+            var map = depManager.map,
+                fullName = map.fullName,
+                name = map.name,
+                plugin = plugins[pluginName] ||
+                        (plugins[pluginName] = defined[pluginName]),
+                load;
+
+            //No need to continue if the manager is already
+            //in the process of loading.
+            if (depManager.loading) {
+                return;
+            }
+            depManager.loading = true;
+
+            load = function (ret) {
+                depManager.callback = function () {
+                    return ret;
+                };
+                execManager(depManager);
+
+                loaded[depManager.id] = true;
+
+                //The loading of this plugin
+                //might have placed other things
+                //in the paused queue. In particular,
+                //a loader plugin that depends on
+                //a different plugin loaded resource.
+                resume();
+            };
+
+            //Allow plugins to load other code without having to know the
+            //context or how to "complete" the load.
+            load.fromText = function (moduleName, text) {
+                /*jslint evil: true */
+                var hasInteractive = useInteractive;
+
+                //Indicate a the module is in process of loading.
+                loaded[moduleName] = false;
+                context.scriptCount += 1;
+
+                //Indicate this is not a "real" module, so do not track it
+                //for builds, it does not map to a real file.
+                context.fake[moduleName] = true;
+
+                //Turn off interactive script matching for IE for any define
+                //calls in the text, then turn it back on at the end.
+                if (hasInteractive) {
+                    useInteractive = false;
+                }
+
+                req.exec(text);
+
+                if (hasInteractive) {
+                    useInteractive = true;
+                }
+
+                //Support anonymous modules.
+                context.completeLoad(moduleName);
+            };
+
+            //No need to continue if the plugin value has already been
+            //defined by a build.
+            if (fullName in defined) {
+                load(defined[fullName]);
+            } else {
+                //Use parentName here since the plugin's name is not reliable,
+                //could be some weird string with no path that actually wants to
+                //reference the parentName's path.
+                plugin.load(name, makeRequire(map.parentMap, true, function (deps, cb) {
+                    var moduleDeps = [],
+                        i, dep, depMap;
+                    //Convert deps to full names and hold on to them
+                    //for reference later, when figuring out if they
+                    //are blocked by a circular dependency.
+                    for (i = 0; (dep = deps[i]); i++) {
+                        depMap = makeModuleMap(dep, map.parentMap);
+                        deps[i] = depMap.fullName;
+                        if (!depMap.prefix) {
+                            moduleDeps.push(deps[i]);
+                        }
+                    }
+                    depManager.moduleDeps = (depManager.moduleDeps || []).concat(moduleDeps);
+                    return context.require(deps, cb);
+                }), load, config);
+            }
+        }
+
+        /**
+         * Adds the manager to the waiting queue. Only fully
+         * resolved items should be in the waiting queue.
+         */
+        function addWait(manager) {
+            if (!waiting[manager.id]) {
+                waiting[manager.id] = manager;
+                waitAry.push(manager);
+                context.waitCount += 1;
+            }
+        }
+
+        /**
+         * Function added to every manager object. Created out here
+         * to avoid new function creation for each manager instance.
+         */
+        function managerAdd(cb) {
+            this.listeners.push(cb);
+        }
+
+        function getManager(map, shouldQueue) {
+            var fullName = map.fullName,
+                prefix = map.prefix,
+                plugin = prefix ? plugins[prefix] ||
+                                (plugins[prefix] = defined[prefix]) : null,
+                manager, created, pluginManager, prefixMap;
+
+            if (fullName) {
+                manager = managerCallbacks[fullName];
+            }
+
+            if (!manager) {
+                created = true;
+                manager = {
+                    //ID is just the full name, but if it is a plugin resource
+                    //for a plugin that has not been loaded,
+                    //then add an ID counter to it.
+                    id: (prefix && !plugin ?
+                        (managerCounter++) + '__p@:' : '') +
+                        (fullName || '__r@' + (managerCounter++)),
+                    map: map,
+                    depCount: 0,
+                    depDone: [],
+                    depCallbacks: [],
+                    deps: [],
+                    listeners: [],
+                    add: managerAdd
+                };
+
+                specified[manager.id] = true;
+
+                //Only track the manager/reuse it if this is a non-plugin
+                //resource. Also only track plugin resources once
+                //the plugin has been loaded, and so the fullName is the
+                //true normalized value.
+                if (fullName && (!prefix || plugins[prefix])) {
+                    managerCallbacks[fullName] = manager;
+                }
+            }
+
+            //If there is a plugin needed, but it is not loaded,
+            //first load the plugin, then continue on.
+            if (prefix && !plugin) {
+                prefixMap = makeModuleMap(prefix);
+
+                //Clear out defined and urlFetched if the plugin was previously
+                //loaded/defined, but not as full module (as in a build
+                //situation). However, only do this work if the plugin is in
+                //defined but does not have a module export value.
+                if (prefix in defined && !defined[prefix]) {
+                    delete defined[prefix];
+                    delete urlFetched[prefixMap.url];
+                }
+
+                pluginManager = getManager(prefixMap, true);
+                pluginManager.add(function (plugin) {
+                    //Create a new manager for the normalized
+                    //resource ID and have it call this manager when
+                    //done.
+                    var newMap = makeModuleMap(map.originalName, map.parentMap),
+                        normalizedManager = getManager(newMap, true);
+
+                    //Indicate this manager is a placeholder for the real,
+                    //normalized thing. Important for when trying to map
+                    //modules and dependencies, for instance, in a build.
+                    manager.placeholder = true;
+
+                    normalizedManager.add(function (resource) {
+                        manager.callback = function () {
+                            return resource;
+                        };
+                        execManager(manager);
+                    });
+                });
+            } else if (created && shouldQueue) {
+                //Indicate the resource is not loaded yet if it is to be
+                //queued.
+                loaded[manager.id] = false;
+                queueDependency(manager);
+                addWait(manager);
+            }
+
+            return manager;
+        }
+
+        function main(inName, depArray, callback, relModuleMap) {
+            var moduleMap = makeModuleMap(inName, relModuleMap),
+                name = moduleMap.name,
+                fullName = moduleMap.fullName,
+                manager = getManager(moduleMap),
+                id = manager.id,
+                deps = manager.deps,
+                i, depArg, depName, depPrefix, cjsMod;
+
+            if (fullName) {
+                //If module already defined for context, or already loaded,
+                //then leave. Also leave if jQuery is registering but it does
+                //not match the desired version number in the config.
+                if (fullName in defined || loaded[id] === true ||
+                    (fullName === "jquery" && config.jQuery &&
+                     config.jQuery !== callback().fn.jquery)) {
+                    return;
+                }
+
+                //Set specified/loaded here for modules that are also loaded
+                //as part of a layer, where onScriptLoad is not fired
+                //for those cases. Do this after the inline define and
+                //dependency tracing is done.
+                specified[id] = true;
+                loaded[id] = true;
+
+                //If module is jQuery set up delaying its dom ready listeners.
+                if (fullName === "jquery" && callback) {
+                    jQueryCheck(callback());
+                }
+            }
+
+            //Attach real depArray and callback to the manager. Do this
+            //only if the module has not been defined already, so do this after
+            //the fullName checks above. IE can call main() more than once
+            //for a module.
+            manager.depArray = depArray;
+            manager.callback = callback;
+
+            //Add the dependencies to the deps field, and register for callbacks
+            //on the dependencies.
+            for (i = 0; i < depArray.length; i++) {
+                depArg = depArray[i];
+                //There could be cases like in IE, where a trailing comma will
+                //introduce a null dependency, so only treat a real dependency
+                //value as a dependency.
+                if (depArg) {
+                    //Split the dependency name into plugin and name parts
+                    depArg = makeModuleMap(depArg, (name ? moduleMap : relModuleMap));
+                    depName = depArg.fullName;
+                    depPrefix = depArg.prefix;
+
+                    //Fix the name in depArray to be just the name, since
+                    //that is how it will be called back later.
+                    depArray[i] = depName;
+
+                    //Fast path CommonJS standard dependencies.
+                    if (depName === "require") {
+                        deps[i] = makeRequire(moduleMap);
+                    } else if (depName === "exports") {
+                        //CommonJS module spec 1.1
+                        deps[i] = defined[fullName] = {};
+                        manager.usingExports = true;
+                    } else if (depName === "module") {
+                        //CommonJS module spec 1.1
+                        manager.cjsModule = cjsMod = deps[i] = {
+                            id: name,
+                            uri: name ? context.nameToUrl(name, null, relModuleMap) : undefined,
+                            exports: defined[fullName]
+                        };
+                    } else if (depName in defined && !(depName in waiting) &&
+                               (!(fullName in needFullExec) ||
+                                (fullName in needFullExec && fullExec[depName]))) {
+                        //Module already defined, and not in a build situation
+                        //where the module is a something that needs full
+                        //execution and this dependency has not been fully
+                        //executed. See r.js's requirePatch.js for more info
+                        //on fullExec.
+                        deps[i] = defined[depName];
+                    } else {
+                        //Mark this dependency as needing full exec if
+                        //the current module needs full exec.
+                        if (fullName in needFullExec) {
+                            needFullExec[depName] = true;
+                            //Reset state so fully executed code will get
+                            //picked up correctly.
+                            delete defined[depName];
+                            urlFetched[depArg.url] = false;
+                        }
+
+                        //Either a resource that is not loaded yet, or a plugin
+                        //resource for either a plugin that has not
+                        //loaded yet.
+                        manager.depCount += 1;
+                        manager.depCallbacks[i] = makeArgCallback(manager, i);
+                        getManager(depArg, true).add(manager.depCallbacks[i]);
+                    }
+                }
+            }
+
+            //Do not bother tracking the manager if it is all done.
+            if (!manager.depCount) {
+                //All done, execute!
+                execManager(manager);
+            } else {
+                addWait(manager);
+            }
+        }
+
+        /**
+         * Convenience method to call main for a define call that was put on
+         * hold in the defQueue.
+         */
+        function callDefMain(args) {
+            main.apply(null, args);
+        }
+
+        /**
+         * jQuery 1.4.3+ supports ways to hold off calling
+         * calling jQuery ready callbacks until all scripts are loaded. Be sure
+         * to track it if the capability exists.. Also, since jQuery 1.4.3 does
+         * not register as a module, need to do some global inference checking.
+         * Even if it does register as a module, not guaranteed to be the precise
+         * name of the global. If a jQuery is tracked for this context, then go
+         * ahead and register it as a module too, if not already in process.
+         */
+        jQueryCheck = function (jqCandidate) {
+            if (!context.jQuery) {
+                var $ = jqCandidate || (typeof jQuery !== "undefined" ? jQuery : null);
+
+                if ($) {
+                    //If a specific version of jQuery is wanted, make sure to only
+                    //use this jQuery if it matches.
+                    if (config.jQuery && $.fn.jquery !== config.jQuery) {
+                        return;
+                    }
+
+                    if ("holdReady" in $ || "readyWait" in $) {
+                        context.jQuery = $;
+
+                        //Manually create a "jquery" module entry if not one already
+                        //or in process. Note this could trigger an attempt at
+                        //a second jQuery registration, but does no harm since
+                        //the first one wins, and it is the same value anyway.
+                        callDefMain(["jquery", [], function () {
+                            return jQuery;
+                        }]);
+
+                        //Ask jQuery to hold DOM ready callbacks.
+                        if (context.scriptCount) {
+                            jQueryHoldReady($, true);
+                            context.jQueryIncremented = true;
+                        }
+                    }
+                }
+            }
+        };
+
+        function findCycle(manager, traced) {
+            var fullName = manager.map.fullName,
+                depArray = manager.depArray,
+                fullyLoaded = true,
+                i, depName, depManager, result;
+
+            if (manager.isDone || !fullName || !loaded[fullName]) {
+                return result;
+            }
+
+            //Found the cycle.
+            if (traced[fullName]) {
+                return manager;
+            }
+
+            traced[fullName] = true;
+
+            //Trace through the dependencies.
+            if (depArray) {
+                for (i = 0; i < depArray.length; i++) {
+                    //Some array members may be null, like if a trailing comma
+                    //IE, so do the explicit [i] access and check if it has a value.
+                    depName = depArray[i];
+                    if (!loaded[depName] && !reservedDependencies[depName]) {
+                        fullyLoaded = false;
+                        break;
+                    }
+                    depManager = waiting[depName];
+                    if (depManager && !depManager.isDone && loaded[depName]) {
+                        result = findCycle(depManager, traced);
+                        if (result) {
+                            break;
+                        }
+                    }
+                }
+                if (!fullyLoaded) {
+                    //Discard the cycle that was found, since it cannot
+                    //be forced yet. Also clear this module from traced.
+                    result = undefined;
+                    delete traced[fullName];
+                }
+            }
+
+            return result;
+        }
+
+        function forceExec(manager, traced) {
+            var fullName = manager.map.fullName,
+                depArray = manager.depArray,
+                i, depName, depManager, prefix, prefixManager, value;
+
+
+            if (manager.isDone || !fullName || !loaded[fullName]) {
+                return undefined;
+            }
+
+            if (fullName) {
+                if (traced[fullName]) {
+                    return defined[fullName];
+                }
+
+                traced[fullName] = true;
+            }
+
+            //Trace through the dependencies.
+            if (depArray) {
+                for (i = 0; i < depArray.length; i++) {
+                    //Some array members may be null, like if a trailing comma
+                    //IE, so do the explicit [i] access and check if it has a value.
+                    depName = depArray[i];
+                    if (depName) {
+                        //First, make sure if it is a plugin resource that the
+                        //plugin is not blocked.
+                        prefix = makeModuleMap(depName).prefix;
+                        if (prefix && (prefixManager = waiting[prefix])) {
+                            forceExec(prefixManager, traced);
+                        }
+                        depManager = waiting[depName];
+                        if (depManager && !depManager.isDone && loaded[depName]) {
+                            value = forceExec(depManager, traced);
+                            manager.depCallbacks[i](value);
+                        }
+                    }
+                }
+            }
+
+            return defined[fullName];
+        }
+
+        /**
+         * Checks if all modules for a context are loaded, and if so, evaluates the
+         * new ones in right dependency order.
+         *
+         * @private
+         */
+        function checkLoaded() {
+            var waitInterval = config.waitSeconds * 1000,
+                //It is possible to disable the wait interval by using waitSeconds of 0.
+                expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
+                noLoads = "", hasLoadedProp = false, stillLoading = false,
+                cycleDeps = [],
+                i, prop, err, manager, cycleManager, moduleDeps;
+
+            //If there are items still in the paused queue processing wait.
+            //This is particularly important in the sync case where each paused
+            //item is processed right away but there may be more waiting.
+            if (context.pausedCount > 0) {
+                return undefined;
+            }
+
+            //Determine if priority loading is done. If so clear the priority. If
+            //not, then do not check
+            if (config.priorityWait) {
+                if (isPriorityDone()) {
+                    //Call resume, since it could have
+                    //some waiting dependencies to trace.
+                    resume();
+                } else {
+                    return undefined;
+                }
+            }
+
+            //See if anything is still in flight.
+            for (prop in loaded) {
+                if (!(prop in empty)) {
+                    hasLoadedProp = true;
+                    if (!loaded[prop]) {
+                        if (expired) {
+                            noLoads += prop + " ";
+                        } else {
+                            stillLoading = true;
+                            if (prop.indexOf('!') === -1) {
+                                //No reason to keep looking for unfinished
+                                //loading. If the only stillLoading is a
+                                //plugin resource though, keep going,
+                                //because it may be that a plugin resource
+                                //is waiting on a non-plugin cycle.
+                                cycleDeps = [];
+                                break;
+                            } else {
+                                moduleDeps = managerCallbacks[prop] && managerCallbacks[prop].moduleDeps;
+                                if (moduleDeps) {
+                                    cycleDeps.push.apply(cycleDeps, moduleDeps);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+
+            //Check for exit conditions.
+            if (!hasLoadedProp && !context.waitCount) {
+                //If the loaded object had no items, then the rest of
+                //the work below does not need to be done.
+                return undefined;
+            }
+            if (expired && noLoads) {
+                //If wait time expired, throw error of unloaded modules.
+                err = makeError("timeout", "Load timeout for modules: " + noLoads);
+                err.requireType = "timeout";
+                err.requireModules = noLoads;
+                err.contextName = context.contextName;
+                return req.onError(err);
+            }
+
+            //If still loading but a plugin is waiting on a regular module cycle
+            //break the cycle.
+            if (stillLoading && cycleDeps.length) {
+                for (i = 0; (manager = waiting[cycleDeps[i]]); i++) {
+                    if ((cycleManager = findCycle(manager, {}))) {
+                        forceExec(cycleManager, {});
+                        break;
+                    }
+                }
+
+            }
+
+            //If still waiting on loads, and the waiting load is something
+            //other than a plugin resource, or there are still outstanding
+            //scripts, then just try back later.
+            if (!expired && (stillLoading || context.scriptCount)) {
+                //Something is still waiting to load. Wait for it, but only
+                //if a timeout is not already in effect.
+                if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
+                    checkLoadedTimeoutId = setTimeout(function () {
+                        checkLoadedTimeoutId = 0;
+                        checkLoaded();
+                    }, 50);
+                }
+                return undefined;
+            }
+
+            //If still have items in the waiting cue, but all modules have
+            //been loaded, then it means there are some circular dependencies
+            //that need to be broken.
+            //However, as a waiting thing is fired, then it can add items to
+            //the waiting cue, and those items should not be fired yet, so
+            //make sure to redo the checkLoaded call after breaking a single
+            //cycle, if nothing else loaded then this logic will pick it up
+            //again.
+            if (context.waitCount) {
+                //Cycle through the waitAry, and call items in sequence.
+                for (i = 0; (manager = waitAry[i]); i++) {
+                    forceExec(manager, {});
+                }
+
+                //If anything got placed in the paused queue, run it down.
+                if (context.paused.length) {
+                    resume();
+                }
+
+                //Only allow this recursion to a certain depth. Only
+                //triggered by errors in calling a module in which its
+                //modules waiting on it cannot finish loading, or some circular
+                //dependencies that then may add more dependencies.
+                //The value of 5 is a bit arbitrary. Hopefully just one extra
+                //pass, or two for the case of circular dependencies generating
+                //more work that gets resolved in the sync node case.
+                if (checkLoadedDepth < 5) {
+                    checkLoadedDepth += 1;
+                    checkLoaded();
+                }
+            }
+
+            checkLoadedDepth = 0;
+
+            //Check for DOM ready, and nothing is waiting across contexts.
+            req.checkReadyState();
+
+            return undefined;
+        }
+
+        /**
+         * Resumes tracing of dependencies and then checks if everything is loaded.
+         */
+        resume = function () {
+            var manager, map, url, i, p, args, fullName;
+
+            //Any defined modules in the global queue, intake them now.
+            context.takeGlobalQueue();
+
+            resumeDepth += 1;
+
+            if (context.scriptCount <= 0) {
+                //Synchronous envs will push the number below zero with the
+                //decrement above, be sure to set it back to zero for good measure.
+                //require() calls that also do not end up loading scripts could
+                //push the number negative too.
+                context.scriptCount = 0;
+            }
+
+            //Make sure any remaining defQueue items get properly processed.
+            while (defQueue.length) {
+                args = defQueue.shift();
+                if (args[0] === null) {
+                    return req.onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
+                } else {
+                    callDefMain(args);
+                }
+            }
+
+            //Skip the resume of paused dependencies
+            //if current context is in priority wait.
+            if (!config.priorityWait || isPriorityDone()) {
+                while (context.paused.length) {
+                    p = context.paused;
+                    context.pausedCount += p.length;
+                    //Reset paused list
+                    context.paused = [];
+
+                    for (i = 0; (manager = p[i]); i++) {
+                        map = manager.map;
+                        url = map.url;
+                        fullName = map.fullName;
+
+                        //If the manager is for a plugin managed resource,
+                        //ask the plugin to load it now.
+                        if (map.prefix) {
+                            callPlugin(map.prefix, manager);
+                        } else {
+                            //Regular dependency.
+                            if (!urlFetched[url] && !loaded[fullName]) {
+                                req.load(context, fullName, url);
+
+                                //Mark the URL as fetched, but only if it is
+                                //not an empty: URL, used by the optimizer.
+                                //In that case we need to be sure to call
+                                //load() for each module that is mapped to
+                                //empty: so that dependencies are satisfied
+                                //correctly.
+                                if (url.indexOf('empty:') !== 0) {
+                                    urlFetched[url] = true;
+                                }
+                            }
+                        }
+                    }
+
+                    //Move the start time for timeout forward.
+                    context.startTime = (new Date()).getTime();
+                    context.pausedCount -= p.length;
+                }
+            }
+
+            //Only check if loaded when resume depth is 1. It is likely that
+            //it is only greater than 1 in sync environments where a factory
+            //function also then calls the callback-style require. In those
+            //cases, the checkLoaded should not occur until the resume
+            //depth is back at the top level.
+            if (resumeDepth === 1) {
+                checkLoaded();
+            }
+
+            resumeDepth -= 1;
+
+            return undefined;
+        };
+
+        //Define the context object. Many of these fields are on here
+        //just to make debugging easier.
+        context = {
+            contextName: contextName,
+            config: config,
+            defQueue: defQueue,
+            waiting: waiting,
+            waitCount: 0,
+            specified: specified,
+            loaded: loaded,
+            urlMap: urlMap,
+            urlFetched: urlFetched,
+            scriptCount: 0,
+            defined: defined,
+            paused: [],
+            pausedCount: 0,
+            plugins: plugins,
+            needFullExec: needFullExec,
+            fake: {},
+            fullExec: fullExec,
+            managerCallbacks: managerCallbacks,
+            makeModuleMap: makeModuleMap,
+            normalize: normalize,
+            /**
+             * Set a configuration for the context.
+             * @param {Object} cfg config object to integrate.
+             */
+            configure: function (cfg) {
+                var paths, prop, packages, pkgs, packagePaths, requireWait;
+
+                //Make sure the baseUrl ends in a slash.
+                if (cfg.baseUrl) {
+                    if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== "/") {
+                        cfg.baseUrl += "/";
+                    }
+                }
+
+                //Save off the paths and packages since they require special processing,
+                //they are additive.
+                paths = config.paths;
+                packages = config.packages;
+                pkgs = config.pkgs;
+
+                //Mix in the config values, favoring the new values over
+                //existing ones in context.config.
+                mixin(config, cfg, true);
+
+                //Adjust paths if necessary.
+                if (cfg.paths) {
+                    for (prop in cfg.paths) {
+                        if (!(prop in empty)) {
+                            paths[prop] = cfg.paths[prop];
+                        }
+                    }
+                    config.paths = paths;
+                }
+
+                packagePaths = cfg.packagePaths;
+                if (packagePaths || cfg.packages) {
+                    //Convert packagePaths into a packages config.
+                    if (packagePaths) {
+                        for (prop in packagePaths) {
+                            if (!(prop in empty)) {
+                                configurePackageDir(pkgs, packagePaths[prop], prop);
+                            }
+                        }
+                    }
+
+                    //Adjust packages if necessary.
+                    if (cfg.packages) {
+                        configurePackageDir(pkgs, cfg.packages);
+                    }
+
+                    //Done with modifications, assing packages back to context config
+                    config.pkgs = pkgs;
+                }
+
+                //If priority loading is in effect, trigger the loads now
+                if (cfg.priority) {
+                    //Hold on to requireWait value, and reset it after done
+                    requireWait = context.requireWait;
+
+                    //Allow tracing some require calls to allow the fetching
+                    //of the priority config.
+                    context.requireWait = false;
+                    //But first, call resume to register any defined modules that may
+                    //be in a data-main built file before the priority config
+                    //call.
+                    resume();
+
+                    context.require(cfg.priority);
+
+                    //Trigger a resume right away, for the case when
+                    //the script with the priority load is done as part
+                    //of a data-main call. In that case the normal resume
+                    //call will not happen because the scriptCount will be
+                    //at 1, since the script for data-main is being processed.
+                    resume();
+
+                    //Restore previous state.
+                    context.requireWait = requireWait;
+                    config.priorityWait = cfg.priority;
+                }
+
+                //If a deps array or a config callback is specified, then call
+                //require with those args. This is useful when require is defined as a
+                //config object before require.js is loaded.
+                if (cfg.deps || cfg.callback) {
+                    context.require(cfg.deps || [], cfg.callback);
+                }
+            },
+
+            requireDefined: function (moduleName, relModuleMap) {
+                return makeModuleMap(moduleName, relModuleMap).fullName in defined;
+            },
+
+            requireSpecified: function (moduleName, relModuleMap) {
+                return makeModuleMap(moduleName, relModuleMap).fullName in specified;
+            },
+
+            require: function (deps, callback, relModuleMap) {
+                var moduleName, fullName, moduleMap;
+                if (typeof deps === "string") {
+                    if (isFunction(callback)) {
+                        //Invalid call
+                        return req.onError(makeError("requireargs", "Invalid require call"));
+                    }
+
+                    //Synchronous access to one module. If require.get is
+                    //available (as in the Node adapter), prefer that.
+                    //In this case deps is the moduleName and callback is
+                    //the relModuleMap
+                    if (req.get) {
+                        return req.get(context, deps, callback);
+                    }
+
+                    //Just return the module wanted. In this scenario, the
+                    //second arg (if passed) is just the relModuleMap.
+                    moduleName = deps;
+                    relModuleMap = callback;
+
+                    //Normalize module name, if it contains . or ..
+                    moduleMap = makeModuleMap(moduleName, relModuleMap);
+                    fullName = moduleMap.fullName;
+
+                    if (!(fullName in defined)) {
+                        return req.onError(makeError("notloaded", "Module name '" +
+                                    moduleMap.fullName +
+                                    "' has not been loaded yet for context: " +
+                                    contextName));
+                    }
+                    return defined[fullName];
+                }
+
+                //Call main but only if there are dependencies or
+                //a callback to call.
+                if (deps && deps.length || callback) {
+                    main(null, deps, callback, relModuleMap);
+                }
+
+                //If the require call does not trigger anything new to load,
+                //then resume the dependency processing.
+                if (!context.requireWait) {
+                    while (!context.scriptCount && context.paused.length) {
+                        resume();
+                    }
+                }
+                return context.require;
+            },
+
+            /**
+             * Internal method to transfer globalQueue items to this context's
+             * defQueue.
+             */
+            takeGlobalQueue: function () {
+                //Push all the globalDefQueue items into the context's defQueue
+                if (globalDefQueue.length) {
+                    //Array splice in the values since the context code has a
+                    //local var ref to defQueue, so cannot just reassign the one
+                    //on context.
+                    apsp.apply(context.defQueue,
+                               [context.defQueue.length - 1, 0].concat(globalDefQueue));
+                    globalDefQueue = [];
+                }
+            },
+
+            /**
+             * Internal method used by environment adapters to complete a load event.
+             * A load event could be a script load or just a load pass from a synchronous
+             * load call.
+             * @param {String} moduleName the name of the module to potentially complete.
+             */
+            completeLoad: function (moduleName) {
+                var args;
+
+                context.takeGlobalQueue();
+
+                while (defQueue.length) {
+                    args = defQueue.shift();
+
+                    if (args[0] === null) {
+                        args[0] = moduleName;
+                        break;
+                    } else if (args[0] === moduleName) {
+                        //Found matching define call for this script!
+                        break;
+                    } else {
+                        //Some other named define call, most likely the result
+                        //of a build layer that included many define calls.
+                        callDefMain(args);
+                        args = null;
+                    }
+                }
+                if (args) {
+                    callDefMain(args);
+                } else {
+                    //A script that does not call define(), so just simulate
+                    //the call for it. Special exception for jQuery dynamic load.
+                    callDefMain([moduleName, [],
+                                moduleName === "jquery" && typeof jQuery !== "undefined" ?
+                                function () {
+                                    return jQuery;
+                                } : null]);
+                }
+
+                //Doing this scriptCount decrement branching because sync envs
+                //need to decrement after resume, otherwise it looks like
+                //loading is complete after the first dependency is fetched.
+                //For browsers, it works fine to decrement after, but it means
+                //the checkLoaded setTimeout 50 ms cost is taken. To avoid
+                //that cost, decrement beforehand.
+                if (req.isAsync) {
+                    context.scriptCount -= 1;
+                }
+                resume();
+                if (!req.isAsync) {
+                    context.scriptCount -= 1;
+                }
+            },
+
+            /**
+             * Converts a module name + .extension into an URL path.
+             * *Requires* the use of a module name. It does not support using
+             * plain URLs like nameToUrl.
+             */
+            toUrl: function (moduleNamePlusExt, relModuleMap) {
+                var index = moduleNamePlusExt.lastIndexOf("."),
+                    ext = null;
+
+                if (index !== -1) {
+                    ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
+                    moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
+                }
+
+                return context.nameToUrl(moduleNamePlusExt, ext, relModuleMap);
+            },
+
+            /**
+             * Converts a module name to a file path. Supports cases where
+             * moduleName may actually be just an URL.
+             */
+            nameToUrl: function (moduleName, ext, relModuleMap) {
+                var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
+                    config = context.config;
+
+                //Normalize module name if have a base relative module name to work from.
+                moduleName = normalize(moduleName, relModuleMap && relModuleMap.fullName);
+
+                //If a colon is in the URL, it indicates a protocol is used and it is just
+                //an URL to a file, or if it starts with a slash or ends with .js, it is just a plain file.
+                //The slash is important for protocol-less URLs as well as full paths.
+                if (req.jsExtRegExp.test(moduleName)) {
+                    //Just a plain path, not module name lookup, so just return it.
+                    //Add extension if it is included. This is a bit wonky, only non-.js things pass
+                    //an extension, this method probably needs to be reworked.
+                    url = moduleName + (ext ? ext : "");
+                } else {
+                    //A module that needs to be converted to a path.
+                    paths = config.paths;
+                    pkgs = config.pkgs;
+
+                    syms = moduleName.split("/");
+                    //For each module name segment, see if there is a path
+                    //registered for it. Start with most specific name
+                    //and work up from it.
+                    for (i = syms.length; i > 0; i--) {
+                        parentModule = syms.slice(0, i).join("/");
+                        if (paths[parentModule]) {
+                            syms.splice(0, i, paths[parentModule]);
+                            break;
+                        } else if ((pkg = pkgs[parentModule])) {
+                            //If module name is just the package name, then looking
+                            //for the main module.
+                            if (moduleName === pkg.name) {
+                                pkgPath = pkg.location + '/' + pkg.main;
+                            } else {
+                                pkgPath = pkg.location;
+                            }
+                            syms.splice(0, i, pkgPath);
+                            break;
+                        }
+                    }
+
+                    //Join the path parts together, then figure out if baseUrl is needed.
+                    url = syms.join("/") + (ext || ".js");
+                    url = (url.charAt(0) === '/' || url.match(/^\w+:/) ? "" : config.baseUrl) + url;
+                }
+
+                return config.urlArgs ? url +
+                                        ((url.indexOf('?') === -1 ? '?' : '&') +
+                                         config.urlArgs) : url;
+            }
+        };
+
+        //Make these visible on the context so can be called at the very
+        //end of the file to bootstrap
+        context.jQueryCheck = jQueryCheck;
+        context.resume = resume;
+
+        return context;
+    }
+
+    /**
+     * Main entry point.
+     *
+     * If the only argument to require is a string, then the module that
+     * is represented by that string is fetched for the appropriate context.
+     *
+     * If the first argument is an array, then it will be treated as an array
+     * of dependency string names to fetch. An optional function callback can
+     * be specified to execute when all of those dependencies are available.
+     *
+     * Make a local req variable to help Caja compliance (it assumes things
+     * on a require that are not standardized), and to give a short
+     * name for minification/local scope use.
+     */
+    req = requirejs = function (deps, callback) {
+
+        //Find the right context, use default
+        var contextName = defContextName,
+            context, config;
+
+        // Determine if have config object in the call.
+        if (!isArray(deps) && typeof deps !== "string") {
+            // deps is a config object
+            config = deps;
+            if (isArray(callback)) {
+                // Adjust args if there are dependencies
+                deps = callback;
+                callback = arguments[2];
+            } else {
+                deps = [];
+            }
+        }
+
+        if (config && config.context) {
+            contextName = config.context;
+        }
+
+        context = contexts[contextName] ||
+                  (contexts[contextName] = newContext(contextName));
+
+        if (config) {
+            context.configure(config);
+        }
+
+        return context.require(deps, callback);
+    };
+
+    /**
+     * Support require.config() to make it easier to cooperate with other
+     * AMD loaders on globally agreed names.
+     */
+    req.config = function (config) {
+        return req(config);
+    };
+
+    /**
+     * Export require as a global, but only if it does not already exist.
+     */
+    if (!require) {
+        require = req;
+    }
+
+    /**
+     * Global require.toUrl(), to match global require, mostly useful
+     * for debugging/work in the global space.
+     */
+    req.toUrl = function (moduleNamePlusExt) {
+        return contexts[defContextName].toUrl(moduleNamePlusExt);
+    };
+
+    req.version = version;
+
+    //Used to filter out dependencies that are already paths.
+    req.jsExtRegExp = /^\/|:|\?|\.js$/;
+    s = req.s = {
+        contexts: contexts,
+        //Stores a list of URLs that should not get async script tag treatment.
+        skipAsync: {}
+    };
+
+    req.isAsync = req.isBrowser = isBrowser;
+    if (isBrowser) {
+        head = s.head = document.getElementsByTagName("head")[0];
+        //If BASE tag is in play, using appendChild is a problem for IE6.
+        //When that browser dies, this can be removed. Details in this jQuery bug:
+        //http://dev.jquery.com/ticket/2709
+        baseElement = document.getElementsByTagName("base")[0];
+        if (baseElement) {
+            head = s.head = baseElement.parentNode;
+        }
+    }
+
+    /**
+     * Any errors that require explicitly generates will be passed to this
+     * function. Intercept/override it if you want custom error handling.
+     * @param {Error} err the error object.
+     */
+    req.onError = function (err) {
+        throw err;
+    };
+
+    /**
+     * Does the request to load a module for the browser case.
+     * Make this a separate function to allow other environments
+     * to override it.
+     *
+     * @param {Object} context the require context to find state.
+     * @param {String} moduleName the name of the module.
+     * @param {Object} url the URL to the module.
+     */
+    req.load = function (context, moduleName, url) {
+        req.resourcesReady(false);
+
+        context.scriptCount += 1;
+        req.attach(url, context, moduleName);
+
+        //If tracking a jQuery, then make sure its ready callbacks
+        //are put on hold to prevent its ready callbacks from
+        //triggering too soon.
+        if (context.jQuery && !context.jQueryIncremented) {
+            jQueryHoldReady(context.jQuery, true);
+            context.jQueryIncremented = true;
+        }
+    };
+
+    function getInteractiveScript() {
+        var scripts, i, script;
+        if (interactiveScript && interactiveScript.readyState === 'interactive') {
+            return interactiveScript;
+        }
+
+        scripts = document.getElementsByTagName('script');
+        for (i = scripts.length - 1; i > -1 && (script = scripts[i]); i--) {
+            if (script.readyState === 'interactive') {
+                return (interactiveScript = script);
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * The function that handles definitions of modules. Differs from
+     * require() in that a string for the module should be the first argument,
+     * and the function to execute after dependencies are loaded should
+     * return a value to define the module corresponding to the first argument's
+     * name.
+     */
+    define = function (name, deps, callback) {
+        var node, context;
+
+        //Allow for anonymous functions
+        if (typeof name !== 'string') {
+            //Adjust args appropriately
+            callback = deps;
+            deps = name;
+            name = null;
+        }
+
+        //This module may not have dependencies
+        if (!isArray(deps)) {
+            callback = deps;
+            deps = [];
+        }
+
+        //If no name, and callback is a function, then figure out if it a
+        //CommonJS thing with dependencies.
+        if (!deps.length && isFunction(callback)) {
+            //Remove comments from the callback string,
+            //look for require calls, and pull them into the dependencies,
+            //but only if there are function args.
+            if (callback.length) {
+                callback
+                    .toString()
+                    .replace(commentRegExp, "")
+                    .replace(cjsRequireRegExp, function (match, dep) {
+                        deps.push(dep);
+                    });
+
+                //May be a CommonJS thing even without require calls, but still
+                //could use exports, and module. Avoid doing exports and module
+                //work though if it just needs require.
+                //REQUIRES the function to expect the CommonJS variables in the
+                //order listed below.
+                deps = (callback.length === 1 ? ["require"] : ["require", "exports", "module"]).concat(deps);
+            }
+        }
+
+        //If in IE 6-8 and hit an anonymous define() call, do the interactive
+        //work.
+        if (useInteractive) {
+            node = currentlyAddingScript || getInteractiveScript();
+            if (node) {
+                if (!name) {
+                    name = node.getAttribute("data-requiremodule");
+                }
+                context = contexts[node.getAttribute("data-requirecontext")];
+            }
+        }
+
+        //Always save off evaluating the def call until the script onload handler.
+        //This allows multiple modules to be in a file without prematurely
+        //tracing dependencies, and allows for anonymous module support,
+        //where the module name is not known until the script onload event
+        //occurs. If no context, use the global queue, and get it processed
+        //in the onscript load callback.
+        (context ? context.defQueue : globalDefQueue).push([name, deps, callback]);
+
+        return undefined;
+    };
+
+    define.amd = {
+        multiversion: true,
+        plugins: true,
+        jQuery: true
+    };
+
+    /**
+     * Executes the text. Normally just uses eval, but can be modified
+     * to use a more environment specific call.
+     * @param {String} text the text to execute/evaluate.
+     */
+    req.exec = function (text) {
+        return eval(text);
+    };
+
+    /**
+     * Executes a module callack function. Broken out as a separate function
+     * solely to allow the build system to sequence the files in the built
+     * layer in the right sequence.
+     *
+     * @private
+     */
+    req.execCb = function (name, callback, args, exports) {
+        return callback.apply(exports, args);
+    };
+
+
+    /**
+     * Adds a node to the DOM. Public function since used by the order plugin.
+     * This method should not normally be called by outside code.
+     */
+    req.addScriptToDom = function (node) {
+        //For some cache cases in IE 6-8, the script executes before the end
+        //of the appendChild execution, so to tie an anonymous define
+        //call to the module name (which is stored on the node), hold on
+        //to a reference to this node, but clear after the DOM insertion.
+        currentlyAddingScript = node;
+        if (baseElement) {
+            head.insertBefore(node, baseElement);
+        } else {
+            head.appendChild(node);
+        }
+        currentlyAddingScript = null;
+    };
+
+    /**
+     * callback for script loads, used to check status of loading.
+     *
+     * @param {Event} evt the event from the browser for the script
+     * that was loaded.
+     *
+     * @private
+     */
+    req.onScriptLoad = function (evt) {
+        //Using currentTarget instead of target for Firefox 2.0's sake. Not
+        //all old browsers will be supported, but this one was easy enough
+        //to support and still makes sense.
+        var node = evt.currentTarget || evt.srcElement, contextName, moduleName,
+            context;
+
+        if (evt.type === "load" || (node && readyRegExp.test(node.readyState))) {
+            //Reset interactive script so a script node is not held onto for
+            //to long.
+            interactiveScript = null;
+
+            //Pull out the name of the module and the context.
+            contextName = node.getAttribute("data-requirecontext");
+            moduleName = node.getAttribute("data-requiremodule");
+            context = contexts[contextName];
+
+            contexts[contextName].completeLoad(moduleName);
+
+            //Clean up script binding. Favor detachEvent because of IE9
+            //issue, see attachEvent/addEventListener comment elsewhere
+            //in this file.
+            if (node.detachEvent && !isOpera) {
+                //Probably IE. If not it will throw an error, which will be
+                //useful to know.
+                node.detachEvent("onreadystatechange", req.onScriptLoad);
+            } else {
+                node.removeEventListener("load", req.onScriptLoad, false);
+            }
+        }
+    };
+
+    /**
+     * Attaches the script represented by the URL to the current
+     * environment. Right now only supports browser loading,
+     * but can be redefined in other environments to do the right thing.
+     * @param {String} url the url of the script to attach.
+     * @param {Object} context the context that wants the script.
+     * @param {moduleName} the name of the module that is associated with the script.
+     * @param {Function} [callback] optional callback, defaults to require.onScriptLoad
+     * @param {String} [type] optional type, defaults to text/javascript
+     * @param {Function} [fetchOnlyFunction] optional function to indicate the script node
+     * should be set up to fetch the script but do not attach it to the DOM
+     * so that it can later be attached to execute it. This is a way for the
+     * order plugin to support ordered loading in IE. Once the script is fetched,
+     * but not executed, the fetchOnlyFunction will be called.
+     */
+    req.attach = function (url, context, moduleName, callback, type, fetchOnlyFunction) {
+        var node;
+        if (isBrowser) {
+            //In the browser so use a script tag
+            callback = callback || req.onScriptLoad;
+            node = context && context.config && context.config.xhtml ?
+                    document.createElementNS("http://www.w3.org/1999/xhtml", "html:script") :
+                    document.createElement("script");
+            node.type = type || (context && context.config.scriptType) ||
+                        "text/javascript";
+            node.charset = "utf-8";
+            //Use async so Gecko does not block on executing the script if something
+            //like a long-polling comet tag is being run first. Gecko likes
+            //to evaluate scripts in DOM order, even for dynamic scripts.
+            //It will fetch them async, but only evaluate the contents in DOM
+            //order, so a long-polling script tag can delay execution of scripts
+            //after it. But telling Gecko we expect async gets us the behavior
+            //we want -- execute it whenever it is finished downloading. Only
+            //Helps Firefox 3.6+
+            //Allow some URLs to not be fetched async. Mostly helps the order!
+            //plugin
+            node.async = !s.skipAsync[url];
+
+            if (context) {
+                node.setAttribute("data-requirecontext", context.contextName);
+            }
+            node.setAttribute("data-requiremodule", moduleName);
+
+            //Set up load listener. Test attachEvent first because IE9 has
+            //a subtle issue in its addEventListener and script onload firings
+            //that do not match the behavior of all other browsers with
+            //addEventListener support, which fire the onload event for a
+            //script right after the script execution. See:
+            //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
+            //UNFORTUNATELY Opera implements attachEvent but does not follow the script
+            //script execution mode.
+            if (node.attachEvent && !isOpera) {
+                //Probably IE. IE (at least 6-8) do not fire
+                //script onload right after executing the script, so
+                //we cannot tie the anonymous define call to a name.
+                //However, IE reports the script as being in "interactive"
+                //readyState at the time of the define call.
+                useInteractive = true;
+
+
+                if (fetchOnlyFunction) {
+                    //Need to use old school onreadystate here since
+                    //when the event fires and the node is not attached
+                    //to the DOM, the evt.srcElement is null, so use
+                    //a closure to remember the node.
+                    node.onreadystatechange = function (evt) {
+                        //Script loaded but not executed.
+                        //Clear loaded handler, set the real one that
+                        //waits for script execution.
+                        if (node.readyState === 'loaded') {
+                            node.onreadystatechange = null;
+                            node.attachEvent("onreadystatechange", callback);
+                            fetchOnlyFunction(node);
+                        }
+                    };
+                } else {
+                    node.attachEvent("onreadystatechange", callback);
+                }
+            } else {
+                node.addEventListener("load", callback, false);
+            }
+            node.src = url;
+
+            //Fetch only means waiting to attach to DOM after loaded.
+            if (!fetchOnlyFunction) {
+                req.addScriptToDom(node);
+            }
+
+            return node;
+        } else if (isWebWorker) {
+            //In a web worker, use importScripts. This is not a very
+            //efficient use of importScripts, importScripts will block until
+            //its script is downloaded and evaluated. However, if web workers
+            //are in play, the expectation that a build has been done so that
+            //only one script needs to be loaded anyway. This may need to be
+            //reevaluated if other use cases become common.
+            importScripts(url);
+
+            //Account for anonymous modules
+            context.completeLoad(moduleName);
+        }
+        return null;
+    };
+
+    //Look for a data-main script attribute, which could also adjust the baseUrl.
+    if (isBrowser) {
+        //Figure out baseUrl. Get it from the script tag with require.js in it.
+        scripts = document.getElementsByTagName("script");
+
+        for (globalI = scripts.length - 1; globalI > -1 && (script = scripts[globalI]); globalI--) {
+            //Set the "head" where we can append children by
+            //using the script's parent.
+            if (!head) {
+                head = script.parentNode;
+            }
+
+            //Look for a data-main attribute to set main script for the page
+            //to load. If it is there, the path to data main becomes the
+            //baseUrl, if it is not already set.
+            if ((dataMain = script.getAttribute('data-main'))) {
+                if (!cfg.baseUrl) {
+                    //Pull off the directory of data-main for use as the
+                    //baseUrl.
+                    src = dataMain.split('/');
+                    mainScript = src.pop();
+                    subPath = src.length ? src.join('/')  + '/' : './';
+
+                    //Set final config.
+                    cfg.baseUrl = subPath;
+                    //Strip off any trailing .js since dataMain is now
+                    //like a module name.
+                    dataMain = mainScript.replace(jsSuffixRegExp, '');
+                }
+
+                //Put the data-main script in the files to load.
+                cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain];
+
+                break;
+            }
+        }
+    }
+
+    //See if there is nothing waiting across contexts, and if not, trigger
+    //resourcesReady.
+    req.checkReadyState = function () {
+        var contexts = s.contexts, prop;
+        for (prop in contexts) {
+            if (!(prop in empty)) {
+                if (contexts[prop].waitCount) {
+                    return;
+                }
+            }
+        }
+        req.resourcesReady(true);
+    };
+
+    /**
+     * Internal function that is triggered whenever all scripts/resources
+     * have been loaded by the loader. Can be overridden by other, for
+     * instance the domReady plugin, which wants to know when all resources
+     * are loaded.
+     */
+    req.resourcesReady = function (isReady) {
+        var contexts, context, prop;
+
+        //First, set the public variable indicating that resources are loading.
+        req.resourcesDone = isReady;
+
+        if (req.resourcesDone) {
+            //If jQuery with DOM ready delayed, release it now.
+            contexts = s.contexts;
+            for (prop in contexts) {
+                if (!(prop in empty)) {
+                    context = contexts[prop];
+                    if (context.jQueryIncremented) {
+                        jQueryHoldReady(context.jQuery, false);
+                        context.jQueryIncremented = false;
+                    }
+                }
+            }
+        }
+    };
+
+    //FF < 3.6 readyState fix. Needed so that domReady plugin
+    //works well in that environment, since require.js is normally
+    //loaded via an HTML script tag so it will be there before window load,
+    //where the domReady plugin is more likely to be loaded after window load.
+    req.pageLoaded = function () {
+        if (document.readyState !== "complete") {
+            document.readyState = "complete";
+        }
+    };
+    if (isBrowser) {
+        if (document.addEventListener) {
+            if (!document.readyState) {
+                document.readyState = "loading";
+                window.addEventListener("load", req.pageLoaded, false);
+            }
+        }
+    }
+
+    //Set up default context. If require was a configuration object, use that as base config.
+    req(cfg);
+
+    //If modules are built into require.js, then need to make sure dependencies are
+    //traced. Use a setTimeout in the browser world, to allow all the modules to register
+    //themselves. In a non-browser env, assume that modules are not built into require.js,
+    //which seems odd to do on the server.
+    if (req.isAsync && typeof setTimeout !== "undefined") {
+        ctx = s.contexts[(cfg.context || defContextName)];
+        //Indicate that the script that includes require() is still loading,
+        //so that require()'d dependencies are not traced until the end of the
+        //file is parsed (approximated via the setTimeout call).
+        ctx.requireWait = true;
+        setTimeout(function () {
+            ctx.requireWait = false;
+
+            if (!ctx.scriptCount) {
+                ctx.resume();
+            }
+            req.checkReadyState();
+        }, 0);
+    }
+}());
diff --git a/classes/file/file.class.php b/classes/file/file.class.php
index 708d950..9928bea 100755
--- a/classes/file/file.class.php
+++ b/classes/file/file.class.php
@@ -1,6 +1,6 @@
 <?php
 /*******************************************************************************
- * Copyright (c) 2007,2008 Eclipse Foundation and others.
+ * Copyright (c) 2007-2013 Eclipse Foundation, IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -13,7 +13,10 @@
  *    Kit Lo (IBM) - patch, bug 258749, Keep spaces at the end of value string
  *    Kit Lo (IBM) - patch, bug 226378, Non-translatable strings or files should not be presented to user for translation
  *    Kit Lo (IBM) - Bug 299402, Extract properties files from Eclipse project update sites for translation
-*******************************************************************************/
+ *    Kit Lo (IBM) - [402215] Extract Orion JavaScript files for translation
+ *******************************************************************************/
+
+require_once("/home/data/httpd/babel.eclipse.org/html/json_encode.php");
 require(dirname(__FILE__) . "/../system/language.class.php"); 
 require(dirname(__FILE__) . "/../system/release_train.class.php"); 
 
@@ -29,7 +32,6 @@
   public $is_active 	= 0;
   public $plugin_id = '';
 
-	
 	function save() {
 		$rValue = false;
 		if($this->name != "" && $this->project_id != "" && $this->version != "") {
@@ -118,7 +120,7 @@
 			  $strings[$string->string_id] = $string;
 			}
 
-			# import existing strings.  $String->save() will deal with merges
+			# import existing strings, $String->save() will deal with merges
 			$previous_line 	= "";
 			$lines 			= explode("\n", $_content);
 			$non_translatable = FALSE;
@@ -190,6 +192,59 @@
 		return $rValue;
 	}
 
+	function parseJs($_content) {
+		if($_content != "") {
+			
+			global $User;
+
+			# find all current active strings for this properties file
+			global $dbh;
+			$strings = array();
+			$sql = "SELECT * from strings WHERE is_active = 1 AND file_id = $this->file_id";
+			$rs_strings = mysql_query($sql, $dbh);
+			while ($myrow_strings = mysql_fetch_assoc($rs_strings)) {
+			  $string = new String();
+			  $string->string_id = $myrow_strings['string_id'];
+			  $string->file_id = $myrow_strings['file_id'];
+			  $string->name = $myrow_strings['name'];
+			  $string->value = $myrow_strings['value'];
+			  $string->userid = $myrow_strings['userid'];
+			  $string->created_on = $myrow_strings['created_on'];
+			  $string->is_active = $myrow_strings['is_active'];
+			  $strings[$string->string_id] = $string;
+			}
+
+			# import existing strings, $String->save() will deal with merges
+			$file_contents = preg_replace("/NON-NLS-(.*)/", "", $_content);
+			$file_contents = preg_replace("/\\/\\/\\$/", "", $file_contents);
+			$file_contents = preg_replace("/((.*?(\n))+.*?)define\(/", "define(", $file_contents);
+			$file_contents = preg_replace("/define\(((.*?(\n))+.*?)\)\;/", "$1", $file_contents);
+			$jsons = new Services_JSON();
+			$lines = $jsons->decode($file_contents);
+			foreach($lines as $key => $value) {
+				$String = new String();
+				$String->file_id 	= $this->file_id;
+				$String->name 		= $key;
+				$String->value 		= $value;
+				$String->userid 	= $User->userid;
+				$String->created_on = getCURDATE();
+				$String->is_active 	= 1;
+				$String->saveJs();
+
+				# remove the string from the list
+				unset($strings[$String->string_id]);
+			}
+
+			# remove strings that are no longer in the properties file
+			foreach ($strings as $string) {
+			  $string->is_active = 0;
+			  if (!$string->save()) {
+			    echo "***ERROR: Cannot deactivate string $string->name in file $string->file_id\n";
+			  }
+			}
+		}
+	}
+
 	/**
 	 * Returns the fragment relative path.
 	 */
diff --git a/classes/string/string.class.php b/classes/string/string.class.php
index 023b501..902b669 100755
--- a/classes/string/string.class.php
+++ b/classes/string/string.class.php
@@ -1,6 +1,6 @@
 <?php
 /*******************************************************************************
- * Copyright (c) 2007 Eclipse Foundation and others.
+ * Copyright (c) 2007-2013 Eclipse Foundation, IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -9,7 +9,8 @@
  * Contributors:
  *    Eclipse Foundation - initial API and implementation
  *    Kit Lo (IBM) - 272661 - Pseudo translations change " to ', breaking link texts
-*******************************************************************************/
+ *    Kit Lo (IBM) - [402215] Extract Orion JavaScript files for translation
+ *******************************************************************************/
 
 class String {
   public $errStrs;
@@ -71,6 +72,53 @@
 		return $rValue;
 	}
 	
+	function saveJs() {
+		$rValue = false;
+		if($this->file_id != 0 && $this->name != "" && $this->userid > 0) {
+			global $dbh;
+
+			$String = $this->getStringFromName($this->file_id, $this->name);
+			if($String->value != $this->value || $String->is_active != $this->is_active) {
+				$sql 		= "INSERT INTO";
+				$created_on = "NOW()";
+				$where 		= "";
+				if($String->string_id > 0) {
+					$this->string_id = $String->string_id;
+					$this->is_active = 1;
+					$sql = "UPDATE";
+					$created_on = "created_on";
+					$where = " WHERE string_id = " . sqlSanitize($this->string_id, $dbh);
+					$Event = new EventLog("strings", "string_id:old_value", $this->string_id . ":" . $String->value, "UPDATE");
+					$Event->add();
+				}
+
+				$sql .= " strings 
+							SET string_id 	= " . sqlSanitize($this->string_id, $dbh) . ",
+								file_id		= " . sqlSanitize($this->file_id, $dbh) . ", 
+								name		= " . returnEscapedQuotedString(sqlSanitize($this->name, $dbh)) . ",
+								value		= " . returnEscapedQuotedString(sqlSanitize($this->value, $dbh)) . ",
+								userid		= " . returnQuotedString(sqlSanitize($this->userid, $dbh)) . ",
+								created_on	= " . $created_on . ",
+								is_active	= " . sqlSanitize($this->is_active, $dbh) . $where;
+				if(mysql_query($sql, $dbh)) {
+					if($this->string_id == 0) {
+						$this->string_id = mysql_insert_id($dbh);
+					}
+					$rValue = true;
+				}
+				else {
+					$GLOBALS['g_ERRSTRS'][1] = mysql_error();
+				}
+			}
+			else {
+				# Imported string is identical.
+				$this->string_id = $String->string_id;
+				$rValue = true;
+			}
+		}
+		return $rValue;
+	}
+	
 	/**
 	 * Get string object from name of a value
 	 *
@@ -162,4 +210,4 @@
 		return $rValue;
 	}
 }
-?>
\ No newline at end of file
+?>
diff --git a/classes/system/common_functions.php b/classes/system/common_functions.php
index 4661461..717fb81 100644
--- a/classes/system/common_functions.php
+++ b/classes/system/common_functions.php
@@ -1,6 +1,6 @@
 <?php
 /*******************************************************************************
- * Copyright (c) 2007-2009 Intalio, Inc.
+ * Copyright (c) 2007-2003 Intalio, Inc., IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -9,7 +9,8 @@
  * Contributors:
  *    Antoine Toulme, Intalio Inc. 217488: Remove Phoenix as a requirement for Babel server
  *    Kit Lo (IBM) - 272661 - Pseudo translations change " to ', breaking link texts
-*******************************************************************************/
+ *    Kit Lo (IBM) - [402215] Extract Orion JavaScript files for translation
+ *******************************************************************************/
 
     /**
      * Sanitize incoming value to prevent SQL injections
@@ -35,6 +36,17 @@
         return "\"" . $_String . "\"";
     }
 
+    function returnEscapedQuotedString($_String) {
+        # Accept: String - String to be quoted
+        # return: string - Quoted String
+        
+        // replace \" with \\"", then quote the whole string
+	// for example: Generate an HTML5 \"Hello World\" website => "Generate an HTML5 \\""Hello World\\"" website"
+        $_String = str_replace('\\"', '\\\\""', $_String);
+    
+        return "\"" . $_String . "\"";
+    }
+
     # Bug 272661 - Pseudo translations change " to ', breaking link texts
     # Use new returnSmartQuotedString function for value string which does not replace " with '.
     function returnSmartQuotedString($_String) {
@@ -128,4 +140,4 @@
         $_SESSION[$varName] = $varVal;
         return $varVal;
     }
-?>
\ No newline at end of file
+?>
