changeset 77:97c1e5102a22 extractapp

New: export table for a file from LGService
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Thu, 16 Apr 2015 14:53:22 +0200
parents c49192885290
children 960ba96efce1
files classes/basecontroller.php classes/basemodel.php classes/loader.php config/config.php controllers/extractapp.php controllers/home.php index.php js/taggingtext.js models/extractapp.php models/home.php views/Extractapp/ConfigTagsInTopic.php views/Extractapp/EditTaglist.php views/Extractapp/EditWordlist.php views/Extractapp/ExportTable.php views/Extractapp/TaggingText.php views/Home/index.php views/Home/test.php
diffstat 17 files changed, 319 insertions(+), 148 deletions(-) [+]
line wrap: on
line diff
--- a/classes/basecontroller.php	Mon Apr 13 15:43:59 2015 +0200
+++ b/classes/basecontroller.php	Thu Apr 16 14:53:22 2015 +0200
@@ -1,8 +1,11 @@
 <?php
-// an instance of the BaseController class can't be created directly; 
-// it can only be extended/inherited by other classes
+/** 
+* An instance of the BaseController class can't be created directly.
+* It can only be extended/inherited by other classes.
+*/
+
 abstract class BaseController {
-
+	
 	protected $urlvalues;
 	protected $action;
 	
@@ -17,6 +20,15 @@
 	}
 	
 	protected function ReturnView($viewmodel, $fullview) {
+		/** 
+		* Return the corresponding view in the views folder. 
+		* We use the same class name as the folder's name and action name as the file's name in the folder hierarchy.
+		* In this design, we can require the corresponding views php code by defining controller and action in url.
+		* 
+		* If you also require the maintemplate.php, which now only contains scripts that need to be inclued, set $fullview to be true; 
+		* otherwise, the maintemplate.php will not be applied.
+		*/
+
 		$viewloc = 'views/' . get_class($this) . '/' . $this->action . '.php';
 		if ($fullview) {
 			require('views/maintemplate.php');
@@ -27,6 +39,10 @@
 	}
 
 	protected function ReturnView_localtest($viewmodel, $fullview) {
+		/** Return the corresponding view in the views folder.  
+		* 
+		* This is only been used when developing on local machine. 
+		*/
         $viewloc = 'views/' . get_class($this) . '/' . $this->action . '.php';
         if ($fullview) {
             require('views/maintemplate_local.php');
--- a/classes/basemodel.php	Mon Apr 13 15:43:59 2015 +0200
+++ b/classes/basemodel.php	Thu Apr 16 14:53:22 2015 +0200
@@ -1,14 +1,11 @@
 <?php
+/**
+* BaseModel is for the general methods/functions.
+* For example, setting related to outside services, connecting to database, get information from database, etc.
+*/
 
 abstract class BaseModel {
-	
-    /*
-    protected $get_text_from_fileId_url = "http://localgazetteers-dev/LGServer/rest/text/getFileText?fileId=";
-    protected $get_text_from_sectionId_url = "http://localgazetteers-dev/LGServer/rest/text/getSectionText?sectionId=";
-    protected $save_to_LGService_url = "http://localgazetteers-dev/LGServer/rest/text/save";
-    protected $save_new_to_LGService_url = "http://localgazetteers-dev/LGServer/rest/text/saveNew";
-
-    */
+    
     protected $get_text_from_fileId_url, $get_text_from_sectionId_url, $save_to_LGService_url, $save_new_to_LGService_url;
 
 	public function __construct() {
--- a/classes/loader.php	Mon Apr 13 15:43:59 2015 +0200
+++ b/classes/loader.php	Thu Apr 16 14:53:22 2015 +0200
@@ -1,4 +1,8 @@
 <?php
+/** 
+* Loader is used to route parameters from input url and set parameters for controller.
+* The routing is done by the RewriteRule written in .htaccess file.
+*/
 
 class Loader {
 	private $controller;
@@ -6,31 +10,39 @@
 	private $urlvalues;
 	private $postdata = 0;
 
-	//store the URL values on object creation
 	public function __construct($urlvalues, $postdata) {
+		/** 
+		* It stores the URL values on object creation.
+		* For example, the URL structure is like this: some_domain_name/Extractapp/TaggingText. 
+		* The controller is "Extractapp" and the action is "TaggingText".
+		* For the "Extractapp" controller, there is a corresponding "extractapp.php" in "./controllers" folder.
+		* For the action "TaggingText", there is a corresponding "TaggingText.php" in "./views/Extractapp" folder.
+		* Under "./view" folder, the first level is named by the controller. Each action belongs to the controller is named by its action name.
+		*/
+
 		$this->urlvalues = $urlvalues;
 		$this->postdata = $postdata;
 		if ($this->urlvalues['controller'] == "") {
-			$this->controller = "extractapp";
-			// TODO: develope home page for the whole service.
-			// change $this->controller to home after developed extract app.
-			// $this->controller = "home";
-			
+			$this->controller = "Extractapp";	// the default controller
+
 		} else {
 			$this->controller = $this->urlvalues['controller'];
 		}
 
 		if ($this->urlvalues['action'] == "") {
-			$this->action = "taggingtext";
-			// $this->action = "index";
+			$this->action = "TaggingText";	// the default action
+
 		} else {
 			$this->action = $this->urlvalues['action'];
 		}
-
 	}
 	
-	//establish the requested controller as an object
 	public function CreateController() {
+		/** 
+		* Establish the requested controller as an object, and check if the query is valid.
+		* The queried controller, which should be extended from BaseController, exists and the queried action should be one of its method.
+		*/
+
 		//does the class exist?
 		if (class_exists($this->controller)) {
 			$parents = class_parents($this->controller);
--- a/config/config.php	Mon Apr 13 15:43:59 2015 +0200
+++ b/config/config.php	Thu Apr 16 14:53:22 2015 +0200
@@ -1,27 +1,44 @@
 <?php
+$conf = new Config();
+$conf->Configuration();
 
-$AT_LOCAL = false;
+class Config {
 
-if (!$AT_LOCAL) {
-	// host at localgazetteers-dev server
-	$mysql_database = "Gazetteer";
-	$mysql_server = "localhost";
-	$mysql_user = "root";
-	$mysql_password = "admin";
-	$server_host = "http://localgazetteers-dev/";
-	$lgserver_url = $server_host."LGServices/";
+	public function Configuration() {
+		/** 
+		* Configuration for the system.
+		* If it runs with LGService, set $AT_LOCAL to be true; 
+		* otherwise (runs on localhost), set it to be false.
+		*/
+
+		global $AT_LOCAL, $mysql_database, $mysql_server, $mysql_user, $mysql_password, $server_host, $lgserver_url,
+				$systemNAME, $system_root_url;
+
+		$AT_LOCAL = false;
 
-} else {
-	// localhost
-	$mysql_database = "Gazetteers";
-	$mysql_server = "localhost";
-	$mysql_user = "root";
-	$mysql_password = "root";
-	$server_host = "http://localhost:1080/localgazetteers-dev/";
-	$lgserver_url = "http://localgazetteers-dev/LGServices/";
+		if (!$AT_LOCAL) {
+			// host at localgazetteers-dev server
+			$mysql_database = "Gazetteer";
+			$mysql_server = "localhost";
+			$mysql_user = "root";
+			$mysql_password = "admin";
+			$server_host = "http://localgazetteers-dev/";
+			$lgserver_url = $server_host."LGServices/";
+
+		} else {
+			// localhost
+			$mysql_database = "Gazetteers";
+			$mysql_server = "localhost";
+			$mysql_user = "root";
+			$mysql_password = "root";
+			$server_host = "http://localhost:1080/localgazetteers-dev/";
+			$lgserver_url = "http://localgazetteers-dev/LGServices/";
+		}
+
+		$systemNAME = "interface";
+		$system_root_url = $server_host."extraction-interface";
+
+	}
+
 }
-
-$systemNAME = "interface";
-$system_root_url = $server_host."extraction-interface";
-
 ?>
--- a/controllers/extractapp.php	Mon Apr 13 15:43:59 2015 +0200
+++ b/controllers/extractapp.php	Thu Apr 16 14:53:22 2015 +0200
@@ -1,4 +1,11 @@
 <?php
+/** 
+    * Extractapp is extended from the BaseController.
+    * This is where we handle the processes for every action.
+    * 
+    * For example, there are five actions in Extractapp, tagging text, exporting a table,
+    * editing the wordlist, and configurating tags in one topic.
+**/
 
 class Extractapp extends BaseController {
 	protected function Index() {
@@ -14,6 +21,21 @@
     }
 
     protected function TaggingText() {
+        /**
+            * TaggingText action in Extractapp handles the taging related actions, for example, 
+            * tagging itself, saving tag results, loading and saving regular expression for tagging.
+            * They are handled by 'func' variable in postdata, which could come from LGService or from extraction-interface application itself.
+            *
+            * From LGService, the postdata contains essential information about the file/section of local gazetteers data.
+            * This happens when user entering to extraction-interface the first time, or after s/he saved her/is tagging results to LGService.
+            * (default one, SaveFullTextToLGService, SmartRegexLoad, SmartRegexSave case)
+            * 
+            * From extraction-interface itself, it contains the information from previous page.
+            * This happens when user choosing another topic in the extraction-interface, 
+            * the page need to retrieve related information from database for the topic.
+            * (ContinueTagging case)
+        */
+
         $viewmodel = $this->viewmodel;
         
         if (isset($this->postdata['func'])) {
@@ -57,7 +79,8 @@
                 break;
 
 
-            default:    // first time visit extraction interface from LGService
+            default:    
+                // This is where the first time user visit extraction interface from LGService
                 $viewmodel->messages['info'] .= "Welcome to Extraction Interface. ";
 
                 if (isset($this->postdata['fileId'])) {
@@ -100,13 +123,37 @@
         
     }
 
+
     protected function ExportTable() {
+        /**
+            * ExportTable action returns "./views/Extractapp/ExportTable.php" view.
+        */
         $viewmodel = $this->viewmodel;
-        $this->ReturnView($viewmodel->ExportTable($this->postdata), true);
+
+        if (isset($this->postdata['func'])) {
+            $func = $this->postdata['func'];
+        }
+        switch ($func) {
+            case 'exportFromExtractionInterface':
+                $this->ReturnView($viewmodel->ExportTable($this->postdata, false), true);
+                break;
+
+            default:    // from file
+                $viewmodel->GetInfoFromPreviousPage($this->postdata);
+                $viewmodel->GetTextFromFileId();
+                $this->ReturnView($viewmodel->ExportTable($this->postdata, true), true);
+                break;
+
+        }
 
     }
 
     protected function EditWordlist() {
+        /**
+            * EditWordlist action returns "./views/Extractapp/EditWordlist.php" view, 
+            * It adds or saves wordlist based on the 'func' variable in postdata.
+        */
+
         $viewmodel = $this->viewmodel;
         if (isset($this->postdata['func'])) {
             $func = $this->postdata['func'];
@@ -126,6 +173,11 @@
 
 
     protected function EditTaglist() {
+        /**
+            * EditTaglist action returns "./views/Extractapp/EditTaglist.php" view.
+            * It adds, saves or delete tag in the current topic.
+        */
+
         $viewmodel = $this->viewmodel;
         if (isset($this->postdata['func'])) {
             $func = $this->postdata['func'];
@@ -148,6 +200,11 @@
 
  
     protected function ConfigTagsInTopic() {
+        /**
+            * ConfigTagsInTopic action returns "./views/Extractapp/ConfigTagsInTopic.php" view.
+            * It shows or updates the tags-in-topic relation.
+        */
+
         $viewmodel = $this->viewmodel;
         if (isset($this->postdata['func'])) {
             $func = $this->postdata['func'];
@@ -162,10 +219,6 @@
          } 
     }
 
-    protected function TestAction() {
-        $this->ReturnView($viewmodel->Test(), true);
-    }
-
 
     
 	
--- a/controllers/home.php	Mon Apr 13 15:43:59 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-<?php
-
-class Home extends BaseController {
-
-	public function __construct($action, $urlvalues, $postdata){
-        parent::__construct($action, $urlvalues, $postdata); 
-        $this->viewmodel = new ExtractappModel();
-    }
-    
-	protected function Index() {
-		$viewmodel = new HomeModel();
-        $this->ReturnView($viewmodel->Index(), false);
-	}
-
-    protected function Test() {
-        $viewmodel = new HomeModel();
-        $this->ReturnView($viewmodel->Test(), true);
-    }
-
-	
-}
-
-
-?>
--- a/index.php	Mon Apr 13 15:43:59 2015 +0200
+++ b/index.php	Thu Apr 16 14:53:22 2015 +0200
@@ -1,7 +1,17 @@
 
 <?php
+/*! \file
+* This is the entry of extraction-interface. 
+* index.php includes neccessary libraries and create a Loader to handle the controll and actions.
+*/
+
+/*
+* Author: Zoe Hong
+* Version: 1.0
+* Date: 15.04.2015
+*/ 
+
 header("Content-Type: text/html;charset=utf-8");
-
 // system configiration
 include_once('config/Lib_mb_utf8.php');
 include_once('config/config.php');
@@ -16,13 +26,13 @@
 require("models/extractapp.php");
 
 // require the controller classes
-require("controllers/home.php");
 require("controllers/extractapp.php");
 
+
 // create the controller and execute the action
 $loader = new Loader($_GET, $_POST);
-
 $controller = $loader->CreateController();
 $controller->ExecuteAction();
 
+
 ?>
--- a/js/taggingtext.js	Mon Apr 13 15:43:59 2015 +0200
+++ b/js/taggingtext.js	Thu Apr 16 14:53:22 2015 +0200
@@ -1,3 +1,7 @@
+/*! \file 
+* This is a js file.
+*/ 
+
 // === for taggingtext.php ===
 var stringBeforeChange="";
 var stringBeforeChangeStack = [];
--- a/models/extractapp.php	Mon Apr 13 15:43:59 2015 +0200
+++ b/models/extractapp.php	Thu Apr 16 14:53:22 2015 +0200
@@ -1,13 +1,11 @@
-
-
 <?php
+/** 
+    * ExtractappModel is extended from the BaseModel.
+    * This is where we implement the functions/models that related to extraction-interface.
+*/
 
 class ExtractappModel extends BaseModel{
     
-	public function Index() {
-		return array("Index Value 1", "Value 2", "Value 3");
-	}
-    
     protected $section_id = 0, $data_path, $file_id = 0, $current_fileId=0, 
         $branch_id = 0, $user_id = 0, $lg_text = "", $topic, $taglist_infile = "", $book_meta = "",$book_dynasty="";
     public $messages = array('info'=>"",'error'=>"",'warning'=>"",'debug'=>"");
@@ -45,9 +43,6 @@
 
     }
 
-
-
-
     public function SetBookMetaDataBySectionId() {
 
         // get book_meta from $$this->get_section_metadata_by_sectionId_url
@@ -64,7 +59,6 @@
 
     }
 
-
     public function GetTextFromSectionId() {  // remove $_postdata as input
         /*
         $section_id = $_postdata['sectionId'];
@@ -92,7 +86,6 @@
         $this->lg_text = $lg_text;
     }
 
-
     // This is only used on localhost
     public function GetTextFromLocal($_id){     
         $this->section_id = $_id;
@@ -329,6 +322,11 @@
             $text .= "</book>\n";
             
         }
+        // --- section info ---
+        $text .= "<section>\n";
+        $text .= "<id>".$this->section_id."</id>\n";
+        $text .= "<name>".$this->section_name."</name>\n";
+        $text .= "</section>\n";
 
         // ---- taglist ---
         // $taglist = $this->taglist_infile;
@@ -547,30 +545,13 @@
     }
 
 
-    // === for export table ===
-    public function ExportTable($postdata) {
-
-        $content = $postdata['content'];
-        $topic = $postdata['topic'];
-        $section_id = $postdata['sectionId'];
-
-        //$section_id = $this->section_id;
-
-        $sectionName = $postdata['sectionName'];
-        $bookId = $postdata['bookId'];
-        $bookName = $postdata['bookName'];
-
-       // =====
+    private function GetTableArray($_taglistArray, $_topic_tag, $_content) {
 
         $outputTableArray = array();
-
-        //$taglistArray = $this->GetTaglistArray();
-        $taglistArray = $this->GetTaglistByTopicID($topic);
-
         $outputTableArray[0]=array();
         $outputTableArray[0][0]=array();
         $outputTableArray[0][1]=array();
-        foreach ( $taglistArray as $value ) {
+        foreach ( $_taglistArray as $value ) {
             $outputTableArray[0][0][$value[2]] = $value[1];
             $outputTableArray[0][1][$value[2]] = $value[1]."(Title)";
         }
@@ -578,9 +559,9 @@
         $outputTableArray[0]["page"] = "頁數";
         $outputTableArray[0]["full"] = "全文";
 
-        foreach ( $taglistArray as $tagValue ) {
-            $content = preg_replace("/<\/".$tagValue[2].">○*<".$tagValue[2].">/u", "", $content);
-            $content = preg_replace("/<".$tagValue[2].">[ ]*<\/".$tagValue[2].">/u", "", $content);
+        foreach ( $_taglistArray as $tagValue ) {
+            $content = preg_replace("/<\/".$tagValue[2].">○*<".$tagValue[2].">/u", "", $_content);
+            $content = preg_replace("/<".$tagValue[2].">[ ]*<\/".$tagValue[2].">/u", "", $_content);
         }
 
         $contentLineArray = explode( "<br>", $content );
@@ -595,7 +576,7 @@
             if ( preg_match("/【<a(.*?)>(.*?)<\/a>】/u", $recordString, $matches) ) {
                 $pageNow = $matches[2];
             }
-            foreach ( $taglistArray as $tagValue ) {
+            foreach ( $_taglistArray as $tagValue ) {
                 if ( preg_match_all("/<".$tagValue[2].">(.*?)<\/".$tagValue[2].">/u", $recordString, $matches, PREG_SET_ORDER) ) {
                     foreach ( $matches as $matchesValue ) {
                         $matchesValue[1] = preg_replace("/○/u", "", $matchesValue[1]);
@@ -626,19 +607,57 @@
             $outputTableArray[$count]["full"] = $value;
         }
         
-        $topic_tag = $this->GetTopicTag($topic);
+        
 
         foreach ( $outputTableArray as $arrayIndex => $arrayValue ) {
             // output each row which the topic tag
             // e.g. the original version is for 'person'           
-            if ( !isset($arrayValue[0][$topic_tag]) ) {
+            if ( !isset($arrayValue[0][$_topic_tag]) ) {
                 unset($outputTableArray[$arrayIndex]);
             }
 
         }
+        // ----- 
 
+        return $outputTableArray;
+    }
+
+    // === for export table ===
+
+    public function ExportTable($postdata, $isFromFile) {
+        if ($isFromFile) {
+            $content = $this->lg_text;
+            $topic = $this->topic;
+            $sectionId = $this->section_id;
+            $sectionName = $this->section_name;
+            $bookId = $this->book_id;
+            $bookName = $this->book_name;
+
+            $taglistArray = $this->taglist_infile;
+
+        } else {
+            $content = $postdata['content'];
+            $topic = $postdata['topic'];
+
+            $section_id = $postdata['sectionId'];
+            $sectionName = $postdata['sectionName'];
+            $bookId = $postdata['bookId'];
+            $bookName = $postdata['bookName'];
+
+            //$taglistArray = $this->GetTaglistArray();
+            $taglistArray = $this->GetTaglistByTopicID($topic);
+        }
+        // =====
+
+        $topic_tag = $this->GetTopicTag($topic);
+
+        // input data: taglistArray, topic_tag, content; output: outputTableArray
+        $outputTableArray = $this->GetTableArray($taglistArray, $topic_tag, $content);
+
+
+
+        // data for view
         $data = array();
-
         $data['outputTableArray'] = $outputTableArray;
         $data['bookId'] = $bookId;
         $data['section_id'] = $section_id;
@@ -651,6 +670,9 @@
     
     // === for manage tag list ===
     public function EditTaglist($_postdata) {
+        /**
+        */
+
         $query = "SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='taglist'";
         $result = mysql_query($query);
         if (!$result) {
@@ -757,6 +779,10 @@
 
     // === for config topic ===
     public function ConfigTagsInTopic($postdata) {
+        /**
+        * 
+        */
+
         $topic = $postdata['topic'];
         $result = $this->GetTopicByID($topic);
         $row = mysql_fetch_assoc($result);
@@ -1015,6 +1041,11 @@
 
     // === for manage wordlist ===
     public function EditWordlist() {
+        /**
+        * EditWordlist shows the wordlist in a new window.
+        * User can view each one of the wordlist and edit it, also s/he can create a new wordlist here.
+        */
+
         $result = $this->GetWordlist();
         $wordlistArray = array();
         while ($row = mysql_fetch_assoc($result)) {
@@ -1164,6 +1195,20 @@
         }
         */
         // -----
+        // TODO: get section_id, section_name from file
+        if ($this->section_id == 0 && isset($xml->section)) {
+            if ($xml->section) {
+                $this->section_id = (string)$xml->section->id;
+                $this->section_name = (string)$xml->section->name;
+            }
+        }
+        // book meta data
+        if (!isset($this->book_id) && isset($xml->book)) {
+            $this->book_id = (string)$xml->book->id;
+            $this->book_name = (string)$xml->book->name;
+        }
+
+
 
         $contentString = (string)($xml->text_content->asXML());
 
@@ -1174,7 +1219,10 @@
     }
 
 
-    private function GetSectionContent() {  // called only by GetTextFromLocal()
+    private function GetSectionContent() {  
+        /** This is only been called by GetTextFromLocal().
+        */
+
         $section_id = $this->GetSectionId();
         $section_info = $this->GetSectionInfo();
 
--- a/models/home.php	Mon Apr 13 15:43:59 2015 +0200
+++ b/models/home.php	Thu Apr 16 14:53:22 2015 +0200
@@ -1,16 +1,13 @@
 <?php
 
 class HomeModel {
-	public function Index() {
-		return array("Index Value 1", "Value 2", "Value 3");
-	}
     
-    public function Test() {
-
-    	
-        return;
-    }
     public function MergeBooksInfoToBooks() {
+        /** 
+        * This function is used to update book table in database. 
+        * It merged some fields in books_info table into books table, but it has not been used now.
+        */
+        
         /* uncomment to do the merge
         // merge books table with books_info table
         $query = "SELECT books_info.volume, books_info.author, books_info.edition, books_info.books_id FROM books INNER JOIN books_info ON books.id=books_info.books_id";
--- a/views/Extractapp/ConfigTagsInTopic.php	Mon Apr 13 15:43:59 2015 +0200
+++ b/views/Extractapp/ConfigTagsInTopic.php	Thu Apr 16 14:53:22 2015 +0200
@@ -1,4 +1,10 @@
 <?php
+/*! \file 
+* This is a view for ConfigTagsInTopic.
+* It shows tags in the current topic, and the other tags that are in our database but not in this topic.
+* User can add/remove the tags in/out of this topic.
+*/
+
 // --- initialize ---
 //$taglistArray = $viewmodel['taglistArray'];
 $topic = $viewmodel['topic'];
@@ -86,7 +92,6 @@
 </script>
 
 <div class="container-fluid" style="margin-left:10%; margin-right:10%">
-   
 		<form name="config" autocomplete='off' action="Javascript:checkTopic(document.config.InTopic)">
 			<h3>Topic: <?php echo $topic_name['name_en'];?> (<?php echo $topic_name['name_ch'];?>, <?php echo $topic_name['name_pinyin'];?>) </h3>
 			
@@ -131,7 +136,6 @@
 				</tr>
 				</tbody>
 			</table>
-			
 		</form>
 </div>
 
--- a/views/Extractapp/EditTaglist.php	Mon Apr 13 15:43:59 2015 +0200
+++ b/views/Extractapp/EditTaglist.php	Thu Apr 16 14:53:22 2015 +0200
@@ -1,4 +1,11 @@
 <?php
+/*! \file 
+* This is the view for EditTaglist.
+* It shows the detail of taglist in the current topic in a new window.
+* User can edit values for each tag except the topic_tag.
+*/
+
+
 // --- initialize ---
 $taglistArray = $viewmodel['taglistArray'];
 $topic_id = $viewmodel['topic_id'];
@@ -31,7 +38,8 @@
 var largestId = JSON.parse('<?php echo json_encode($largestId) ?>');
 var topic_tag_id = JSON.parse('<?php echo json_encode($topic_tag_id) ?>');
 
-function addTag( ) {
+function addTag() {
+
 	largestId++;
 	var row = tableMain.insertBefore(document.createElement("tr"), document.getElementById("trAddTag") );
 	row.setAttribute("height","50");
--- a/views/Extractapp/EditWordlist.php	Mon Apr 13 15:43:59 2015 +0200
+++ b/views/Extractapp/EditWordlist.php	Thu Apr 16 14:53:22 2015 +0200
@@ -1,4 +1,10 @@
 <?php
+/*! \file 
+* This is the view for EditWordlist.
+* It shows the wordlist and allows user to view or edit it.
+* User can create new wordlist here.
+*/
+
 // --- initialize ---
 $wordlistArray = $viewmodel['wordlistArray'];
 ?>
--- a/views/Extractapp/ExportTable.php	Mon Apr 13 15:43:59 2015 +0200
+++ b/views/Extractapp/ExportTable.php	Thu Apr 16 14:53:22 2015 +0200
@@ -1,4 +1,9 @@
 <?php
+/*! \file 
+* This is the view for ExportTable.
+* It shows a html table with each row as a topic object and each column as a tag/attribute. 
+*/
+
 // --- initialize ---
 $outputTableArray = $viewmodel['outputTableArray'];
 $bookId = $viewmodel['bookId'];
@@ -6,8 +11,6 @@
 $bookName = $viewmodel['bookName'];
 $sectionName = $viewmodel['sectionName'];
 
-
-
 ?>
 
 <html>
--- a/views/Extractapp/TaggingText.php	Mon Apr 13 15:43:59 2015 +0200
+++ b/views/Extractapp/TaggingText.php	Thu Apr 16 14:53:22 2015 +0200
@@ -1,4 +1,11 @@
 <?php
+/*! \file 
+* This is the view for TaggingText.
+* It shows the extraction-interface application itself.
+* It contains the tagging area and toolbox on the right side.
+*  
+*/
+
 // --- initialize config file and input text ---
 $stringInput = $viewmodel['stringInput'];
 $wordlistArray = $viewmodel['wordlistArray'];
@@ -81,7 +88,12 @@
     }
 }
 
+
+
 function reloadText() {
+    /**
+    * Reload the text when there is a new version of this branch.
+    */
     // confirm to reload
     var r = confirm("Are you sure you want to load the latest version (in a new tab)?");
     if (r != true) {
@@ -347,6 +359,11 @@
     form.setAttribute("target", "_blank");
     
     var hiddenField = document.createElement("input");      
+    hiddenField.setAttribute("name", "func");
+    hiddenField.setAttribute("value", "exportFromExtractionInterface");
+    form.appendChild(hiddenField);
+
+    var hiddenField = document.createElement("input");      
     hiddenField.setAttribute("name", "content");
     hiddenField.setAttribute("value", container.innerHTML);
     form.appendChild(hiddenField);
@@ -364,20 +381,20 @@
     var info = JSON.parse( '<?php echo json_encode($info) ?>');
 
     if (info) {
-    var hiddenField = document.createElement("input");      
-    hiddenField.setAttribute("name", "bookId");
-    hiddenField.setAttribute("value", info['book_id']);
-    form.appendChild(hiddenField);   
+        var hiddenField = document.createElement("input");      
+        hiddenField.setAttribute("name", "bookId");
+        hiddenField.setAttribute("value", info['book_id']);
+        form.appendChild(hiddenField);   
 
-    var hiddenField = document.createElement("input");      
-    hiddenField.setAttribute("name", "bookName");
-    hiddenField.setAttribute("value", info['book_name']);
-    form.appendChild(hiddenField);   
-    
-    var hiddenField = document.createElement("input");      
-    hiddenField.setAttribute("name", "sectionName");
-    hiddenField.setAttribute("value", info['section_name']);
-    form.appendChild(hiddenField);
+        var hiddenField = document.createElement("input");      
+        hiddenField.setAttribute("name", "bookName");
+        hiddenField.setAttribute("value", info['book_name']);
+        form.appendChild(hiddenField);   
+        
+        var hiddenField = document.createElement("input");      
+        hiddenField.setAttribute("name", "sectionName");
+        hiddenField.setAttribute("value", info['section_name']);
+        form.appendChild(hiddenField);
 
     };
 
@@ -404,6 +421,11 @@
     form.setAttribute("target", "_blank");
     
     var hiddenField = document.createElement("input");      
+    hiddenField.setAttribute("name", "func");
+    hiddenField.setAttribute("value", "exportFromExtractionInterface");
+    form.appendChild(hiddenField); 
+
+    var hiddenField = document.createElement("input");      
     hiddenField.setAttribute("name", "content");
     hiddenField.setAttribute("value", str.match(new RegExp(regexText, "g")));
     form.appendChild(hiddenField);
@@ -464,6 +486,13 @@
     form.setAttribute("target", "_blank");
     
     var hiddenField = document.createElement("input");      
+    hiddenField.setAttribute("name", "func");
+    hiddenField.setAttribute("value", "exportFromExtractionInterface");
+    form.appendChild(hiddenField); 
+  
+
+
+    var hiddenField = document.createElement("input");      
     hiddenField.setAttribute("name", "content");
     hiddenField.setAttribute("value", str);
     form.appendChild(hiddenField);
--- a/views/Home/index.php	Mon Apr 13 15:43:59 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-<h1>Home/index.php</h1>
--- a/views/Home/test.php	Mon Apr 13 15:43:59 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<h1>Home/test.php</h1>
-
-<?php
-// --- initialize config file and input text ---
-$name = $viewmodel['name'];
-
-
-?>
\ No newline at end of file