diff views/Extractapp/TaggingText.php @ 58:a11f9103b8db extractapp

New: 1.display messages 2.handle saving conflict:up-to-date or reload text
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 31 Mar 2015 10:59:52 +0200
parents 5cf9720a2e25
children 6e44605eb4f6
line wrap: on
line diff
--- a/views/Extractapp/TaggingText.php	Mon Mar 30 17:23:47 2015 +0200
+++ b/views/Extractapp/TaggingText.php	Tue Mar 31 10:59:52 2015 +0200
@@ -107,14 +107,16 @@
 
 }
 
-// TODO: Popup to proceeding the saving situations
 function handleFileVersionConflict() {
     var info = JSON.parse('<?php echo json_encode($info) ?>');
     console.log("currentFileId="+info['current_fileId']);
     
-    if (info['current_fileId'] != 0 && info['current_fileId'] != info['file_id']){
+    // if (info['current_fileId'] != 0 && info['current_fileId'] != info['file_id']){
+    if (info['current_fileId'] != 0){
         // -- there might be conflicts between different version
         alert("Your saving failed! Someone edited this file and saved before you.");
+        $('#reloadTextButton').css("display", "block");
+
         return;
     }
     return;
@@ -794,7 +796,6 @@
   
 }
 
-// --- for config tags in topic ---
 function _postForContineTagging(form) {
     var hiddenField = document.createElement("input");      
     hiddenField.setAttribute("name", "text");
@@ -930,7 +931,14 @@
 </div>
 
 
-<p class="bg-info" style="margin:10 30 10 30; max-width:1250"> <?php echo $messages; ?> </p>
+<div style="margin:10 30 10 30; max-width:1250">
+    <p class="bg-info" style=""> <?php echo $messages['info']; ?> </p>
+    <p class="bg-warning" style=""> <?php echo $messages['warning']; ?> </p>
+    <p class="bg-danger" style=""> <?php echo $messages['error']; ?> </p>
+    <button id="reloadTextButton" onclick="reloadText(<?php echo $default_topic_id; ?>)" style="display:none;">Reload</button>
+
+    <p class="bg-default" style=""> <?php echo $messages['debug']; ?> </p>
+</div>
 
 <table width="1270" border="1" style="margin:10 30 10 30;">
     <tr>
@@ -977,9 +985,6 @@
             <div id="follow-scroll" style="position:absolute; height:680px; overflow:scroll; margin:0 5 15 5; max-width:270px">
                 <form action="javascript:void(0);">   
                     <fieldset>
-                        <button onclick="reloadText(<?php echo $default_topic_id; ?>)">Reload</button>
-                    </fieldset>
-                    <fieldset>
                         <legend><h5 class="text-success"> Config Topic: </h5></legend>
                         <div> current topic is <?php echo $topic_name; ?> 
                             <button onclick="chooseTopic()" class="btn btn-xs btn-default">Change</button>
@@ -990,14 +995,14 @@
                     <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>
+                        <button onclick="smartRegexNew()" style="height: 35px; 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: 100px">Run</button>
-                        <button onclick="replaceSmartRunWithBr()" style="height: 30px; width: 100px">Run(with Br)</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 onclick="replaceSmartRun()" style="height: 35px; width: 100px">Run</button>
+                        <button onclick="replaceSmartRunWithBr()" style="height: 35px; width: 100px">Run(with Br)</button></br>
+                        <button onclick="replaceSmartRunSpace()" style="height: 35px; width: 220px">Run(Allow space between Group)</button></br>
+                        <button onclick="smartRegexSave(<?php echo $default_topic_id; ?>)" style="height: 35px; width: 70px">Save</button>
+                        <button onclick="smartRegexLoad(<?php echo $default_topic_id; ?>)" style="height: 35px; width: 70px">Load</button>
+                        <button onclick="smartRegexEmpty()" style="height: 35px; width: 70px">Clear</button></br>
                         <!--
                         <button id="example" type="button" class="btn btn-sm btn-default" data-toggle="popover">Load</button>
                         -->
@@ -1005,17 +1010,17 @@
                     
                     <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="tagNameWithLastName()" style="height: 35px; width: 220px">Tag Word Begin With Surname</button></br>
+                        <button onclick="tagNameWithLastName2()" style="height: 35px; 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>
+                        <button onclick="Undo()" style="height: 35px; width: 220px" id="buttonUndo" disabled="true">Undo</button>
                     </fieldset>
                 
                     <fieldset>
                         <legend><h5 class="text-success"> Edit:</h5></legend>
 
-                        <button onclick="saveTextToLGService()" id="saveTextToLGService_id" style="height: 30px; width: 220px">Save to LGService</button></br>
+                        <button onclick="saveTextToLGService()" id="saveTextToLGService_id" style="height: 35px; 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 -->
@@ -1023,20 +1028,20 @@
                         <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>
+                        <button onclick="editText()" id="editTextId" style="height: 35px; 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('./EditWordlist')" style="height: 35px; 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>
+                        <button onclick="editTaglist(<?php echo $default_topic_id; ?>)" style="height: 35px; 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>
+                        <button onclick="exportPage(<?php echo $default_topic_id;?>)" style="height: 35px; width: 220px">Export</button></br>
+                        <button onclick="exportAll(<?php echo $default_topic_id;?>)" style="height: 35px; width: 220px">Export All</button></br>
                     </fieldset>
                 
                     <fieldset>