First iteration of Map inputs
diff --git a/babel-setup.sql b/babel-setup.sql
index be15b2e..3ad2cc7 100644
--- a/babel-setup.sql
+++ b/babel-setup.sql
@@ -54,6 +54,23 @@
   KEY `locale` (`locale`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
+
+
+--
+-- Table structure for table `map_files`
+--
+
+DROP TABLE IF EXISTS `map_files`;
+CREATE TABLE `map_files` (
+  `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',
+  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
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
 --
 -- Table structure for table `profiles`
 --
diff --git a/classes/file/file.class.php b/classes/file/file.class.php
index cdfa40a..15ed4ef 100755
--- a/classes/file/file.class.php
+++ b/classes/file/file.class.php
@@ -16,18 +16,18 @@
   
   public $file_id		= 0;
   public $project_id	= '';
+  public $version		= '';
   public $name			= '';
   public $is_active 	= 0;
 
 	
 	function save() {
 		$rValue = false;
-		if($this->name != "" && $this->project_id != "") {
+		if($this->name != "" && $this->project_id != "" && $this->version > 0) {
 			global $App, $dbh;
 
-			
 			if($this->file_id == 0) {
-				$this->file_id = $this->getFileID($this->name, $this->project_id);
+				$this->file_id = $this->getFileID($this->name, $this->project_id, $this->version);
 			}
 			
 			$sql 	= "INSERT INTO";
@@ -42,6 +42,7 @@
 			$sql .= " files 
 						SET file_id 	= " . $App->sqlSanitize($this->file_id, $dbh) . ",
 							project_id	= " . $App->returnQuotedString($App->sqlSanitize($this->project_id, $dbh)) . ", 
+							version		= " . $App->sqlSanitize($this->version, $dbh) . ", 
 							name		= " . $App->returnQuotedString($App->sqlSanitize($this->name, $dbh)) . ",
 							is_active	= 1" . $where;
 			if(mysql_query($sql, $dbh)) {
@@ -59,16 +60,17 @@
 		return $rValue;
 	}
 	
-	function getFileID($_name, $_project_id) {
+	function getFileID($_name, $_project_id, $_version) {
 		$rValue = 0;
-		if($this->name != "" && $this->project_id != "") {
+		if($this->name != "" && $this->project_id != "" && $_version > 0) {
 			global $App, $dbh;
 
 			$sql = "SELECT file_id
 				FROM 
 					files 
 				WHERE name = " . $App->returnQuotedString($App->sqlSanitize($_name, $dbh)) . "
-					AND project_id = " . $App->returnQuotedString($App->sqlSanitize($_project_id, $dbh));	
+					AND project_id = " . $App->returnQuotedString($App->sqlSanitize($_project_id, $dbh)) . "	
+					AND version = " . $App->sqlSanitize($_version, $dbh);
 
 			$result = mysql_query($sql, $dbh);
 			if($result && mysql_num_rows($result) > 0) {
@@ -89,11 +91,17 @@
 			$lines = explode("\n", $_content);
 			foreach($lines as $line) {
 				if(strlen($line) > 0 && $line[0] != "#" && $line[0] != ";") {
+					
+					#TODO: valid lines ending with \ mean the next line is a continuation, like UNIX!!
+					
 					$tags = explode("=", trim($line), 2);
 					if(count($tags) > 1) {
 						if($rValue != "") {
 							$rValue .= ",";
 						}
+						$tags[0] = trim($tags[0]);
+						$tags[1] = trim($tags[1]);
+						
 						$rValue .= $tags[0];
 						
 						$String = new String();
@@ -129,6 +137,5 @@
 		}
 		return $rValue;
 	}
-	
 }
 ?>
\ No newline at end of file
diff --git a/html/process_map_files.php b/html/process_map_files.php
new file mode 100755
index 0000000..f2aac34
--- /dev/null
+++ b/html/process_map_files.php
@@ -0,0 +1,121 @@
+<?php
+/*******************************************************************************
+ * Copyright (c) 2008 Eclipse Foundation 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:
+ *    Eclipse Foundation - Initial API and implementation
+*******************************************************************************/
+include("global.php");
+InitPage("");
+
+
+require(BABEL_BASE_DIR . "classes/file/file.class.php");
+$html_spacer = "&#160;&#160;&#160;&#160;";
+
+global $App, $dbh;
+
+if(!is_dir("/tmp/tmp-babel")) {
+	mkdir("/tmp/tmp-babel") || die("Cannot create a working directory");
+}
+chdir("/tmp/tmp-babel")  || die("Cannot use working directory");
+
+
+
+
+$sql = "SELECT * FROM map_files WHERE is_active = 1";
+$rs_maps = mysql_query($sql, $dbh);
+while($myrow = mysql_fetch_assoc($rs_maps)) {
+	echo "Processing map file: " . $myrow['filename'] . " in location: " . $myrow['location'] . "<br />";
+	
+	$tmpdir = "/tmp/tmp-babel/" . $myrow['project_id'];
+	if(!is_dir($tmpdir)) {
+		mkdir($tmpdir) || die("Cannot create working directory $tmpdir !");
+	}
+	chdir($tmpdir) || die("Cannot write to $tmpdir !"); 
+	
+	$h = fopen($myrow['location'], "rb");
+	$file_contents = stream_get_contents($h);
+	fclose($h);
+	$aLines = split("\n", $file_contents);
+	
+	
+	foreach ($aLines as $line) {
+		$line = trim($line);
+
+		if(preg_match("/^(plugin|fragment)/", $line)) {
+			echo $html_spacer . "Processling line: " . $line . "<br />";
+			$aParts = split("=", $line);
+			$aElements = split("@", $aParts[0]);		
+			if($aElements[0] == "plugin") {
+				echo $html_spacer . $html_spacer . "Processling plugin: " . $aParts[1] . "<br />";
+				$aStuff = parseLocation($aParts[1]);
+				
+				$tagstring = "";
+				if(isset($aStuff['tag'])) {
+					$tagstring = "-r " . $aStuff['tag'] . " ";
+				}
+				
+				$command = "cvs -d " . $aStuff['cvsroot'] . " co " . $tagstring . $aElements[1];
+				echo $html_spacer . $html_spacer ."<font color=blue>" . $command . "</font><br />";
+				$out = shell_exec($command);
+				
+				# process the output lines for .properties
+				$aOutLines = split("\n", $out);
+				foreach ($aOutLines as $out_line) {
+					$out_line = trim($out_line);
+					if(preg_match("/\.properties$/", $out_line)) {
+						# this is a .properties file!
+						$parts = split(" ", $out_line);
+						$file_name = $parts[1]; 
+						echo $html_spacer . $html_spacer . $html_spacer . "<font color=green>Processing .properties file: " . $file_name . "</font><br />";
+						
+						$File = new File();
+						$File->project_id 	= $myrow['project_id'];
+						$File->version		= $myrow['version'];
+						$File->name 		= $file_name;
+						if(!$File->save()) {
+							echo $html_spacer . $html_spacer . $html_spacer . $html_spacer . "<font color=red>Error saving file: " . $file_name . "</font><br />";
+						}
+						else {
+							# Start importing the strings!
+							$fh      = fopen($file_name, 'r');
+							$size 	 = filesize($file_name);
+						
+							$content = fread($fh, $size);
+							fclose($fh);
+						
+							$strings = $File->parseProperties($content);
+						}
+									
+					}
+				}
+			}			
+		}
+	}
+}
+
+function parseLocation($in_string) {
+	# in_string looks something like this:
+	# v_832,:pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse,
+	$aElements = array();
+	
+	$aLocation = split(",", $in_string);
+	foreach($aLocation as $location_part) {
+		# TAG  
+		if(preg_match("/^[0-9a-zA-Z_]+$/", $location_part) && !isset($aElements['cvsroot'])) {
+			$aElements['tag'] = $location_part;
+		}
+		# CVSROOT
+		if(preg_match("/^:.*:.*@.*:\//", $location_part)) {
+			$aElements['cvsroot'] = $location_part;
+		}
+	}
+	
+	return $aElements;
+}
+
+?>
\ No newline at end of file