changeset 21:c805470cefee

Remove bootstrap.TaggingText UI layout modification
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 24 Feb 2015 16:09:59 +0100
parents 04db1dd9d10d
children a8ae5cbc3364
files .DS_Store develop/controllers/extractapp.php develop/js/taggingtext.js develop/models/extractapp.php develop/views/Extractapp/configtagsintopic.php develop/views/Extractapp/edittaglist.php develop/views/Extractapp/taggingtext.php develop/views/maintemplate.php
diffstat 8 files changed, 349 insertions(+), 205 deletions(-) [+]
line wrap: on
line diff
Binary file .DS_Store has changed
--- a/develop/controllers/extractapp.php	Mon Feb 23 14:34:43 2015 +0100
+++ b/develop/controllers/extractapp.php	Tue Feb 24 16:09:59 2015 +0100
@@ -23,7 +23,7 @@
                 $this->ReturnView($viewmodel->StartTagging(), true); 
                 break;   
             case 'SaveFullTextToLGService':
-                $viewmodel->messages .= "[Z] SaveFullTextToLGService! ";
+                $viewmodel->messages .= "SaveFullTextToLGService! "."<br>";
                 $viewmodel->GetInfoFromPreviousPage($this->postdata);
                 $response = $viewmodel->SaveFullTextToLGService($this->postdata);
                 
@@ -40,7 +40,7 @@
                 break;
 
             case 'ContinueTagging':
-                $viewmodel->messages .= "[Z] (Countinue tagging) ";
+                $viewmodel->messages .= "(Countinue tagging) "."<br>";
                 if ($this->postdata['topic']) {
                     $viewmodel->SetTopic($this->postdata['topic']);
                 }
@@ -49,7 +49,7 @@
                 break;
 
             default:    // first time visit extraction interface from LGService
-                $viewmodel->messages .= "[Z] Welcome to Extraction Interface. ";
+                $viewmodel->messages .= "Welcome to Extraction Interface. "."<br>";
 
                 if ($this->postdata['fileId'] != 0) { // ($this->postdata['branchId'] != 0) {
                     // get text from fileId, from LGService
--- a/develop/js/taggingtext.js	Mon Feb 23 14:34:43 2015 +0100
+++ b/develop/js/taggingtext.js	Tue Feb 24 16:09:59 2015 +0100
@@ -619,10 +619,7 @@
 }
 
 function smartRegexSave(topic_id) {
-
     console.log(topic_id);
-
-
     var name=prompt("Please enter this Regex name",RegexLoadedName);
     if (name!=null){
         $.ajax({
@@ -738,107 +735,6 @@
 }
 // ===
 
-// === for exporttable.php ===
-function exportTable( range, container ) {
-    //MsgBox("enter function");
-    var form = document.createElement("form");
-    form.setAttribute("method", "post");
-    form.setAttribute("action", "./ExportTable");
-    form.setAttribute("target", "_blank");
-    
-    var hiddenField = document.createElement("input");      
-    hiddenField.setAttribute("name", "content");
-    hiddenField.setAttribute("value", container.innerHTML);
-    form.appendChild(hiddenField);
-
-    var hiddenField = document.createElement("input");      
-    hiddenField.setAttribute("name", "sectionid");
-    hiddenField.setAttribute("value", "<?php echo $section_id; ?>");
-    form.appendChild(hiddenField);
-    
-    var hiddenField2 = document.createElement("input");      
-    hiddenField2.setAttribute("name", "topic");
-    hiddenField2.setAttribute("value", topic_id);
-    form.appendChild(hiddenField2);
-
-    if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
-        document.body.appendChild(form);
-        form.submit();
-    } else {
-        form.submit(); // works under IE and Chrome, but not FF  
-    }
-}
-
-function exportPage() {
-    var startPage = $('#exportPageStart').val();
-    var endPage = $('#exportPageEnd').val();
-
-    var el = document.getElementById("editable-area");
-    var str="" + el.innerHTML;
-
-    var regexText="【<a([^<>]*?)>"+startPage+"</a>】(.*?)【<a([^<>]*?)>"+endPage+"</a>】";
-    
-    var form = document.createElement("form");
-    form.setAttribute("method", "post");
-    form.setAttribute("action", "./ExportTable");
-    form.setAttribute("target", "_blank");
-    
-    var hiddenField = document.createElement("input");      
-    hiddenField.setAttribute("name", "content");
-    hiddenField.setAttribute("value", str.match(new RegExp(regexText, "g")));
-    form.appendChild(hiddenField);
-
-    var hiddenField = document.createElement("input");      
-    hiddenField.setAttribute("name", "sectionid");
-    hiddenField.setAttribute("value", "<?php echo $section_id; ?>");
-    form.appendChild(hiddenField);
-    
-    if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
-        document.body.appendChild(form);
-        form.submit();
-    } else {
-        form.submit(); // works under IE and Chrome, but not FF  
-    }
-}
-
-function exportAll(topic_id) {
-    var el = document.getElementById("editable-area");
-    var str= "" + el.innerHTML;
-    var form = document.createElement("form");
-    form.setAttribute("method", "post");
-    //form.setAttribute("action", "exportTable.php");
-    form.setAttribute("action", "./ExportTable");//+section_id);  // hand to controller
-    form.setAttribute("target", "_blank");
-    
-    var hiddenField = document.createElement("input");      
-    hiddenField.setAttribute("name", "content");
-    hiddenField.setAttribute("value", str);
-    form.appendChild(hiddenField);
-
-    var hiddenField = document.createElement("input");      
-    hiddenField.setAttribute("name", "topic");
-    hiddenField.setAttribute("value", topic_id);
-    form.appendChild(hiddenField);
-
-    console.log(topic_id);
-    
-    /*
-    var hiddenField = document.createElement("input");      
-    hiddenField.setAttribute("name", "sectionid");
-    hiddenField.setAttribute("value", section_id);
-    form.appendChild(hiddenField);
-    */
-
-    if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
-        document.body.appendChild(form);
-        form.submit();
-    } else {
-        form.submit(); // works under IE and Chrome, but not FF  
-    }
-
-
-}
-// ===========
 
 // === for editwordlist.php ===
 function addNewList() {
--- a/develop/models/extractapp.php	Mon Feb 23 14:34:43 2015 +0100
+++ b/develop/models/extractapp.php	Tue Feb 24 16:09:59 2015 +0100
@@ -8,7 +8,7 @@
 		return array("Index Value 1", "Value 2", "Value 3");
 	}
     
-    protected $section_id = 0, $data_path, $file_id = 0, $branch_id = 0, $user_id = 0, $lg_text = "";
+    protected $section_id = 0, $data_path, $file_id = 0, $branch_id = 0, $user_id = 0, $lg_text = "", $topic = 0;
     public $messages = "";
 
     private function Initialize($_urlvalues) {
@@ -84,7 +84,13 @@
         if ($_postdata['userId']) {
             $this->user_id = $_postdata['userId'];
         }
+        if ($_postdata['topic_id']) {
+            $this->topic = $_postdata['topic_id'];
+        }
 
+        $this->messages .= "Info: ";
+        $this->messages .= "file_id=".$this->file_id.", section_id=".$this->section_id;
+        $this->messages .= ", user_id=".$this->user_id.", branch_id=".$this->branch_id.", topic_id=".$this->topic."<br>";
 
     }
     public function InitData($_postdata) {
@@ -365,7 +371,9 @@
 
         $content = $postdata['content'];
         $topic = $postdata['topic'];
-        $section_id = $this->section_id;
+        $section_id = $postdata['sectionId'];
+
+        //$section_id = $this->section_id;
         
 
         // TODO: this should be get from LGServic: sectionName, bookId, bookName
@@ -487,6 +495,9 @@
     // === for manage tag list ===
     public function EditTaglist($_postdata) {
         
+        $query = "SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'taglist'";
+        $largest_id = mysql_query($query);
+
         $topic_id = $_postdata['topic_id'];
         $result = $this->GetTaglistByTopicID($topic_id);
 
@@ -508,6 +519,9 @@
         $data = array();
         $data['taglistArray'] = $taglistArray;
         $data['topic_id'] = $topic_id;
+        $data['largest_id'] = $largest_id;
+
+
         return $data;
        
     }
@@ -599,14 +613,112 @@
         $data['topic'] = $topic;
         $data['topic_name'] = $topic_name;
 
+
+
+
+        // ------
+        $query = "SELECT taglist.*, topic_tag_relation.topic_id FROM taglist LEFT JOIN topic_tag_relation ON taglist.id = topic_tag_relation.tag_id ORDER BY `topic_id`";
+        $result = mysql_query($query);
+        if (!$result) {
+            return json_encode("Failed during selecting/joining taglist and topic_tag_relation table.");
+        }
+
+        $tag_intopic = array();
+        $tag_others = array();
+        $tag_tmp_others = array();
+        while ($row = mysql_fetch_assoc($result)) {
+            if ($row['topic_id'] == $topic) {
+                array_push($tag_intopic, array('id=>'=>$row['id'],'name'=>$row['name'], 'tag'=>$row['tag'], 'color'=>$row['color'], 'topic_id'=>$row['topic_id']));
+            } else {
+                array_push($tag_tmp_others, array('id=>'=>$row['id'],'name'=>$row['name'], 'tag'=>$row['tag'], 'color'=>$row['color'], 'topic_id'=>$row['topic_id']));
+            }
+        }
+
+        
+        foreach ($tag_tmp_others as $tmp) {
+            $cnt = 0;
+            foreach ($tag_intopic as $intopic) {
+                if ($tmp['tag'] == $intopic['tag']) {
+                    break;
+                } else {
+                    $cnt ++;
+                }
+            }
+            if ($cnt == count($tag_intopic)) {
+                array_push($tag_others, $tmp);
+            }
+        }
+        
+
+        $data['tag_intopic'] = $tag_intopic;
+        $data['tag_others'] = $tag_others;
+
         return $data;
     }
+
+
     public function UpdateTagsInTopic($_postdata) {
         $topic_id = $_postdata['topic_id'];
         $tag_ids = json_decode(str_replace('\\', '', $_postdata['ids']));
 
         // update topic_tag_relation by tags_ids array as `tag_id` and topic_id as `topic_id`
-        $query = "SELECT * FROM topic_tag_relation";
+        // --- add new topic_tag_relation ---
+        foreach ($tag_ids as $tag_id) {
+            $query = "SELECT * FROM topic_tag_relation WHERE tag_id=".$tag_id;
+            $result = mysql_query($query);
+            if (!$result) {
+                echo json_encode("error when select from topic_tag_relation");
+            }
+            $topic_tag = array();
+            $flag = false;
+            while ($row = mysql_fetch_assoc($result)) {
+                if ($row['topic_id'] == $topic_id) {
+                    $flag = true;
+                    break;
+                }
+            }
+            if (!$flag) {
+                // insert a row into topic_tag_relation table
+                $queryUpdate = "INSERT INTO topic_tag_relation (topic_id, tag_id) VALUES (".$topic_id.",".$tag_id.")";
+                $resultUpdate = mysql_query($queryUpdate); 
+                if (!$resultUpdate) {
+                    return json_encode("error when insert topic_tag_relation table");
+                }   
+            }
+
+        }
+
+        // --- remove tags from this topic ---
+        $query = "SELECT * FROM topic_tag_relation WHERE topic_id=".$topic_id;
+        $result = mysql_query($query);
+        if (!$result) {
+            echo json_encode("error when select from topic_tag_relation");
+        }
+
+        while ($row = mysql_fetch_assoc($result)) {
+            $cnt = 0;
+            foreach ($tag_ids as $tag_id) {
+                if ($row['tag_id'] == $tag_id) {
+                    break;
+                } else {
+                    $cnt ++;
+                }
+            }
+            $_id = $row['id'];
+            if ($cnt == count($tag_ids)) {
+                // delete row with (topic_id, tag_ids)
+                $queryDelete = "DELETE FROM topic_tag_relation WHERE id=".$_id;
+                $resultDelete = mysql_query($queryDelete);
+                if (!$resultDelete) {
+                    echo json_encode("error when delete from topic_tag_relation");
+                }
+            }
+        }
+
+    
+
+        /*
+§        $query = "SELECT * FROM topic_tag_relation";
         $result = mysql_query($query);
         if (!$result) {
             echo json_encode("error when select from topic_tag_relation");
@@ -616,6 +728,7 @@
             array_push($topic_tag, array('tag_id'=>$row['tag_id'], 'topic_id'=>$row['topic_id']));
         }
 
+
         foreach ($topic_tag as $value) {
             $flag = false;
             foreach ($tag_ids as $tag_id) {
@@ -639,6 +752,7 @@
                 }   
             }
         }
+        */
 
     }
 
--- a/develop/views/Extractapp/configtagsintopic.php	Mon Feb 23 14:34:43 2015 +0100
+++ b/develop/views/Extractapp/configtagsintopic.php	Tue Feb 24 16:09:59 2015 +0100
@@ -3,6 +3,8 @@
 $taglistArray = $viewmodel['taglistArray'];
 $topic = $viewmodel['topic'];
 $topic_name = $viewmodel['topic_name'];
+$tag_intopic = $viewmodel['tag_intopic'];
+$tag_others = $viewmodel['tag_others'];
 
 ?>
 
--- a/develop/views/Extractapp/edittaglist.php	Mon Feb 23 14:34:43 2015 +0100
+++ b/develop/views/Extractapp/edittaglist.php	Tue Feb 24 16:09:59 2015 +0100
@@ -2,6 +2,8 @@
 // --- initialize ---
 $taglistArray = $viewmodel['taglistArray'];
 $topic_id = $viewmodel['topic_id'];
+$largestId = $viewmodel['largest_id'];
+var_dump($largestId);
 
 ?>
 
@@ -228,12 +230,10 @@
 			console.log("error when newTag");
 		},
 		success: function (e) {
-
 			alert("Saved!");
 			document.location.reload(true);
 		}
 	}).done(function(result) {
-
 	});
 }
 
@@ -267,7 +267,6 @@
 			document.location.reload(true);
 		}
 	}).done(function(result) {
-		
 	});
 }
 
--- a/develop/views/Extractapp/taggingtext.php	Mon Feb 23 14:34:43 2015 +0100
+++ b/develop/views/Extractapp/taggingtext.php	Tue Feb 24 16:09:59 2015 +0100
@@ -84,22 +84,42 @@
 ?>
 
 $(document).ready(function(){
+    
+    // --- for sidebar--- 
     //run once
-    /* no need, fixed sidebar
     var el=$('#follow-scroll');
     var originalelpos=el.offset().top; // take it where it originally is on the page
-    */
+    
 
     //run on scroll
-    /*
     $(window).scroll(function(){
         var el = $('#follow-scroll'); // important! (local)
         var elpos = el.offset().top; // take current situation
         var windowpos = $(window).scrollTop();
         var finaldestination = windowpos+originalelpos;
-        el.stop().animate({'top':finaldestination},500);
+        //el.stop().animate({'top':finaldestination},500);
+        el.stop().animate({'top':finaldestination},0);
     });
-    */
+
+    //--- for popups ---
+    //run once
+    var el=$('#popups');
+    var originalelpos=el.offset().top; // take it where it originally is on the page
+    
+    //run on scroll
+    $(window).scroll(function(){
+        var el = $('#popups'); // important! (local)
+        var elpos = el.offset().top; // take current situation
+        var windowpos = $(window).scrollTop();
+        var finaldestination = windowpos+originalelpos;
+        //el.stop().animate({'top':finaldestination},500);
+        el.stop().animate({'top':finaldestination},0);
+    });
+
+
+
+
+
 
     // Popup choosing topic if first time to this section. without branchId
     var info = JSON.parse('<?php echo json_encode($info) ?>');
@@ -230,6 +250,115 @@
 });
 
 
+// === for exporttable.php ===
+function exportTable( range, container ) {
+    //MsgBox("enter function");
+    var form = document.createElement("form");
+    form.setAttribute("method", "post");
+    form.setAttribute("action", "./ExportTable");
+    form.setAttribute("target", "_blank");
+    
+    var hiddenField = document.createElement("input");      
+    hiddenField.setAttribute("name", "content");
+    hiddenField.setAttribute("value", container.innerHTML);
+    form.appendChild(hiddenField);
+
+    var hiddenField = document.createElement("input");      
+    hiddenField.setAttribute("name", "sectionid");
+    hiddenField.setAttribute("value", "<?php echo $section_id; ?>");
+    form.appendChild(hiddenField);
+    
+    var hiddenField2 = document.createElement("input");      
+    hiddenField2.setAttribute("name", "topic");
+    hiddenField2.setAttribute("value", topic_id);
+    form.appendChild(hiddenField2);
+
+    if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
+        document.body.appendChild(form);
+        form.submit();
+    } else {
+        form.submit(); // works under IE and Chrome, but not FF  
+    }
+}
+
+function exportPage(topic_id) {
+    var startPage = $('#exportPageStart').val();
+    var endPage = $('#exportPageEnd').val();
+
+    var el = document.getElementById("editable-area");
+    var str="" + el.innerHTML;
+
+    var regexText="【<a([^<>]*?)>"+startPage+"</a>】(.*?)【<a([^<>]*?)>"+endPage+"</a>】";
+    
+    var form = document.createElement("form");
+    form.setAttribute("method", "post");
+    form.setAttribute("action", "./ExportTable");
+    form.setAttribute("target", "_blank");
+    
+    var hiddenField = document.createElement("input");      
+    hiddenField.setAttribute("name", "content");
+    hiddenField.setAttribute("value", str.match(new RegExp(regexText, "g")));
+    form.appendChild(hiddenField);
+
+    var hiddenField = document.createElement("input");      
+    hiddenField.setAttribute("name", "topic");
+    hiddenField.setAttribute("value", topic_id);
+    form.appendChild(hiddenField);
+
+    var section_id = JSON.parse('<?php echo json_encode($section_id) ?>');
+    console.log("section_id: "+section_id+", topic_id: "+topic_id);
+
+    var hiddenField = document.createElement("input");      
+    hiddenField.setAttribute("name", "sectionId");
+    hiddenField.setAttribute("value", section_id);
+    form.appendChild(hiddenField);   
+ 
+
+    if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
+        document.body.appendChild(form);
+        form.submit();
+    } else {
+        form.submit(); // works under IE and Chrome, but not FF  
+    }
+}
+
+function exportAll(topic_id) {
+    var el = document.getElementById("editable-area");
+    var str= "" + el.innerHTML;
+    var form = document.createElement("form");
+    form.setAttribute("method", "post");
+    //form.setAttribute("action", "exportTable.php");
+    form.setAttribute("action", "./ExportTable");//+section_id);  // hand to controller
+    form.setAttribute("target", "_blank");
+    
+    var hiddenField = document.createElement("input");      
+    hiddenField.setAttribute("name", "content");
+    hiddenField.setAttribute("value", str);
+    form.appendChild(hiddenField);
+
+    var hiddenField = document.createElement("input");      
+    hiddenField.setAttribute("name", "topic");
+    hiddenField.setAttribute("value", topic_id);
+    form.appendChild(hiddenField);
+
+    var section_id = JSON.parse('<?php echo json_encode($section_id) ?>');
+    console.log("section_id: "+section_id+", topic_id: "+topic_id);
+
+    var hiddenField = document.createElement("input");      
+    hiddenField.setAttribute("name", "sectionId");
+    hiddenField.setAttribute("value", section_id);
+    form.appendChild(hiddenField);   
+    
+    if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
+        document.body.appendChild(form);
+        form.submit();
+    } else {
+        form.submit(); // works under IE and Chrome, but not FF  
+    }
+
+
+}
+// ===========
 
 function replaceSmartRegex() {
     saveUndoText();
@@ -272,12 +401,14 @@
 
 function saveTextToLGService() {
     var info = JSON.parse('<?php echo json_encode($info) ?>');
-
+    var topic_id = JSON.parse('<?php echo json_encode($default_topic_id) ?>');
 
     // if this is a new branch, ask for label
     if (info['branch_id'] == 0) {
+        var cnt = 0;
         var label = prompt("Please enter your label for this new branch", "label for section "+info['section_id']);
-        while (label == null) {
+        while (label == null && cnt <= 3) {
+            cnt ++;
             label = prompt("Please enter your label for this new branch (not empty)", "label for section "+info['section_id']);
         }    
     };
@@ -328,6 +459,10 @@
     hiddenField.setAttribute("value", text);
     form.appendChild(hiddenField);
 
+    var hiddenField = document.createElement("input");      
+    hiddenField.setAttribute("name", "topic_id");
+    hiddenField.setAttribute("value", topic_id);
+    form.appendChild(hiddenField); 
     
     if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
         document.body.appendChild(form);
@@ -479,23 +614,23 @@
 });
 
 
-// init for popover used in bootstrap
-$(function () {
-  $('[data-toggle="popover"]').popover()
-})
-
-
 
 </script>
+
  
 <div id="popup-window" style="display: none; background-color:white; height:300px; width:300px; margin:200 0 0 200;position:fixed; z-index:2">
 </div>
 
-<div class="container-fluid">
-    <div class="row">
-        <div class="col-xs-8 col-sm-8 col-md-8 col-lg-7 col-lg-offset-1" style="position:fixed; height:30px; z-index:99"> 
-            <p class="bg-info"> <?php echo $messages; ?> </p>
-            <div id="popups" style="position:relative; width:300px; margin-left: 100%">
+
+<p class="bg-info" style="margin:10 30 10 30; max-width:1250"> <?php echo $messages; ?> </p>
+
+<table width="1270" border="1" style="margin:10 30 10 30;">
+    <tr>
+        <td width="980" style="padding:0 5 0 5; margin: 0 5 0 5;">
+            <div id="editable-area" class="area" style="max-width: 980"><?php echo $stringInput; ?></div>
+        </td>
+        <td width="290" valign="top">
+            <div id="popups" style="position:absolute; width:300px; ">
                 <div id="load_topic_div" style="position: absolute; display: none; z-index:2"></div>
                 <div id="load_regex_div" style="position: absolute; display: none; z-index:2;"></div>
                 <div id="smartRegexPopUpDiv" style="position: absolute; display: none; z-index:2">
@@ -529,84 +664,81 @@
                     <button id="smartRegexPopUpFor" onclick="replaceSmartFor()" class="btn btn-default" style="">>></button>
                     <button onclick="replaceSmartClose()" class="btn btn-default" style="">Close</button>
                 </div>
-                
             </div>
-        </div>
-        
-        <div id="follow-scroll" class="col-xs-4 col-xs-offset-8 col-sm-4 col-sm-offset-8 col-md-4 col-md-offset-8 col-lg-3 col-lg-offset-8" style="position:fixed; width:100%; height:700px; overflow:scroll;">
-            <form action="javascript:void(0);">   
-                <fieldset>
-                    <legend><h5 class="text-success"> Config Topic: </h5></legend>
-                    <div> current topic is <?php echo $topic_name; ?> 
-                        <button onclick="chooseTopic(<?php echo $default_topic_id; ?>)" class="btn btn-xs btn-default">Change</button>
-                    </div>
-                    <button onclick="configTagsInTopic(<?php echo $default_topic_id;?>)" class="btn btn-sm btn-default" style="">Config Tags</button></br>
-                </fieldset>
+
+            <div id="follow-scroll" style="position:absolute; height:680px; overflow:scroll;margin:0 5 5 5; max-width:270px">
+                <form action="javascript:void(0);">   
+                    <fieldset>
+                        <legend><h5 class="text-success"> Config Topic: </h5></legend>
+                        <div> current topic is <?php echo $topic_name; ?> 
+                            <button onclick="chooseTopic(<?php echo $default_topic_id; ?>)" class="btn btn-xs btn-default">Change</button>
+                        </div>
+                        <button onclick="configTagsInTopic(<?php echo $default_topic_id;?>)" class="btn btn-sm btn-default" style="">Config Tags</button></br>
+                    </fieldset>
 
-                <fieldset>
-                    <legend><h5 class="text-success"> Replace By <i><b>Smart Regex</b></i>©: </h5></legend>
-                    <div id="smartRegexShowDiv"></div><br>
-                    <button onclick="smartRegexNew()" style="height: 30px; width: 220px">Add Regex Group</button></br>
-                    Range: <input type="text" size="5" id="regexPageStart">to<input type="text" size="5" id="regexPageEnd"><br>
-                    <button onclick="replaceSmartRun()" style="height: 30px; width: 220px">Run</button></br>
-                    <button onclick="replaceSmartRunSpace()" style="height: 30px; width: 220px">Run(Allow space between Group)</button></br>
-                    <button onclick="smartRegexSave(<?php echo $default_topic_id; ?>)" style="height: 30px; width: 70px">Save</button>
-                    <button onclick="smartRegexLoad(<?php echo $default_topic_id; ?>)" style="height: 30px; width: 70px">Load</button>
-                    <button onclick="smartRegexEmpty()" style="height: 30px; width: 70px">Clear</button></br>
-                    <!--
-                    <button id="example" type="button" class="btn btn-sm btn-default" data-toggle="popover">Load</button>
-                    -->
-                </fieldset>
+                    <fieldset>
+                        <legend><h5 class="text-success"> Replace By <i><b>Smart Regex</b></i>©: </h5></legend>
+                        <div id="smartRegexShowDiv"></div><br>
+                        <button onclick="smartRegexNew()" style="height: 30px; width: 220px">Add Regex Group</button></br>
+                        Range: <input type="text" size="5" id="regexPageStart">to<input type="text" size="5" id="regexPageEnd"><br>
+                        <button onclick="replaceSmartRun()" style="height: 30px; width: 220px">Run</button></br>
+                        <button onclick="replaceSmartRunSpace()" style="height: 30px; width: 220px">Run(Allow space between Group)</button></br>
+                        <button onclick="smartRegexSave(<?php echo $default_topic_id; ?>)" style="height: 30px; width: 70px">Save</button>
+                        <button onclick="smartRegexLoad(<?php echo $default_topic_id; ?>)" style="height: 30px; width: 70px">Load</button>
+                        <button onclick="smartRegexEmpty()" style="height: 30px; width: 70px">Clear</button></br>
+                        <!--
+                        <button id="example" type="button" class="btn btn-sm btn-default" data-toggle="popover">Load</button>
+                        -->
+                    </fieldset>
+                    
+                    <fieldset>
+                        <legend><h5 class="text-success"> Tag by rule:</h5></legend>
+                        <button onclick="tagNameWithLastName()" style="height: 30px; width: 220px">Tag Word Begin With Surname</button></br>
+                        <button onclick="tagNameWithLastName2()" style="height: 30px; width: 170px">Tag Word Begin With</button><input type="text" size="2" id="surname"></br>
+                        <!--<button onclick="tagTime()" style="height: 30px; width: 220px">Tag Time</button></br>-->
+                        <!--<button onclick="tagBiogAddr()" style="height: 30px; width: 220px">Tag BiogAddr</button></br>-->
+                        <button onclick="Undo()" style="height: 30px; width: 220px" id="buttonUndo" disabled="true">Undo</button>
+                    </fieldset>
                 
-                <fieldset>
-                    <legend><h5 class="text-success"> Tag by rule:</h5></legend>
-                    <button onclick="tagNameWithLastName()" style="height: 30px; width: 220px">Tag Word Begin With Surname</button></br>
-                    <button onclick="tagNameWithLastName2()" style="height: 30px; width: 170px">Tag Word Begin With</button><input type="text" size="2" id="surname"></br>
-                    <!--<button onclick="tagTime()" style="height: 30px; width: 220px">Tag Time</button></br>-->
-                    <!--<button onclick="tagBiogAddr()" style="height: 30px; width: 220px">Tag BiogAddr</button></br>-->
-                    <button onclick="Undo()" style="height: 30px; width: 220px" id="buttonUndo" disabled="true">Undo</button>
-                </fieldset>
-            
-                <fieldset>
-                    <legend><h5 class="text-success"> Edit:</h5></legend>
-                    <button onclick="saveTextToLGService()" style="height: 30px; width: 220px">Save to LGService</button></br>
-                
-                    <!--<button onclick="cleanUpTextArea()" style="height: 30px; width: 220px">Reform the text</button></br>-->
-                    <button onclick="saveText(<?php echo $section_id; ?>)" style="height: 30px; width: 220px">Save the text</button></br>
-                    <button onclick="editText()" id="editTextId" style="height: 30px; width: 220px">Edit the text</button></br>
-                    </br>
-                    <button onclick="window.open('./EditWordlist')" style="height: 30px; width: 220px">Manage Word List</button></br>
-                    <!--
-                    <button onclick="window.open('./EditTaglist')" style="height: 30px; width: 220px">Manage Tag List</button></br>
-                    -->
-                    <button onclick="editTaglist(<?php echo $default_topic_id; ?>)" style="height: 30px; width: 220px">Manage Tag List</button></br>
-                </fieldset>
+                    <fieldset>
+                        <legend><h5 class="text-success"> Edit:</h5></legend>
+                        <button onclick="saveTextToLGService()" style="height: 30px; width: 220px">Save to LGService</button></br>
+                    
+                        <!--<button onclick="cleanUpTextArea()" style="height: 30px; width: 220px">Reform the text</button></br>-->
+                        <!-- save text in local. replaced by saveTextToLGService, which is also saving on copy in local in development stage
+                        <button onclick="saveText(<?php echo $section_id; ?>)" style="height: 30px; width: 220px">Save the text</button></br>
+                        -->
+                        <button onclick="editText()" id="editTextId" style="height: 30px; width: 220px">Edit the text</button></br>
+                        </br>
+                        <button onclick="window.open('./EditWordlist')" style="height: 30px; width: 220px">Manage Word List</button></br>
+                        <!--
+                        <button onclick="window.open('./EditTaglist')" style="height: 30px; width: 220px">Manage Tag List</button></br>
+                        -->
+                        <button onclick="editTaglist(<?php echo $default_topic_id; ?>)" style="height: 30px; width: 220px">Manage Tag List</button></br>
+                    </fieldset>
+                    
+                    <fieldset>
+                        <legend><h5 class="text-success"> Export:</h5></legend>
+                        Page: <input type="text" size="5" id="exportPageStart">to<input type="text" size="5" id="exportPageEnd"><br>
+                        <button onclick="exportPage(<?php echo $default_topic_id;?>)" style="height: 30px; width: 220px">Export</button></br>
+                        <button onclick="exportAll(<?php echo $default_topic_id;?>)" style="height: 30px; width: 220px">Export All</button></br>
+                    </fieldset>
                 
-                <fieldset>
-                    <legend><h5 class="text-success"> Export:</h5></legend>
-                    Page: <input type="text" size="5" id="exportPageStart">to<input type="text" size="5" id="exportPageEnd"><br>
-                    <button onclick="exportPage()" style="height: 30px; width: 220px">Export</button></br>
-                    <button onclick="exportAll(<?php echo $default_topic_id;?>)" style="height: 30px; width: 220px">Export All</button></br>
-                </fieldset>
-            
-                <fieldset>
-                    <legend><h5 class="text-success"> Replace By <i><b>Regex</b></i>: </h5></legend>
-                    Range: <input type="text" size="5" id="regexPageStart2">to<input type="text" size="5" id="regexPageEnd2"><br>
-                    Regex: <input type="text" size="30" id="regexText"></br>
-                    Replace: <input type="text" size="30" id="replaceText"><br>
-                    <button onclick="replaceSmartRegex()">Replace!</button>
-                </fieldset>
-            </form>
-        </div>
-    </div>
-    
-    <div class="row" style="margin-top:30px;">
-        <div id="editable-area" class="col-xs-8 col-sm-8 col-md-8 col-lg-7 col-lg-offset-1" style="z-index:1">
-            <?php echo $stringInput; ?>
-        </div>
-    </div>
+                    <fieldset>
+                        <legend><h5 class="text-success"> Replace By <i><b>Regex</b></i>: </h5></legend>
+                        Range: <input type="text" size="5" id="regexPageStart2">to<input type="text" size="5" id="regexPageEnd2"><br>
+                        Regex: <input type="text" size="23" id="regexText"></br>
+                        Replace: <input type="text" size="23" id="replaceText"><br>
+                        <button onclick="replaceSmartRegex()">Replace!</button>
+                    </fieldset>
+                </form>
+            </div>
+        </td>
+    </tr>
 
-</div>
+</table>
+
+
 
 
 </body>
--- a/develop/views/maintemplate.php	Mon Feb 23 14:34:43 2015 +0100
+++ b/develop/views/maintemplate.php	Tue Feb 24 16:09:59 2015 +0100
@@ -12,12 +12,13 @@
 
 <!-- Bootstrap -->
 <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
+<!--
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
 
 <link href="../css/bootstrap.min.css" rel="stylesheet">
 <script src="../js/bootstrap.min.js"></script>
 <script src="../js/bootstrap.js"></script>
-
+-->
 
 </head>
 <body>