changeset 59:6e44605eb4f6 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 11:32:25 +0200
parents a11f9103b8db
children 3239979f6673
files controllers/extractapp.php models/extractapp.php views/Extractapp/TaggingText.php
diffstat 3 files changed, 10 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/controllers/extractapp.php	Tue Mar 31 10:59:52 2015 +0200
+++ b/controllers/extractapp.php	Tue Mar 31 11:32:25 2015 +0200
@@ -23,7 +23,7 @@
                 $this->ReturnView($viewmodel->StartTagging(), true); 
                 break;   
             case 'SaveFullTextToLGService':
-                $viewmodel->messages['info'] .= "SaveFullTextToLGService! "."<br>";
+                $viewmodel->messages['info'] .= "SaveFullTextToLGService! ";
                 $viewmodel->GetInfoFromPreviousPage($this->postdata);
                 $response = $viewmodel->SaveFullTextToLGService($this->postdata);
                 $viewmodel->UpdateInfoByResponseFromLGService($response);    // update file_id, branch_id, user_id
@@ -38,7 +38,7 @@
                 $viewmodel->SmartRegexSave($this->postdata);
                 break;
             case 'ReloadText':
-                $viewmodel->messages['info'] .= "Reload the latest text "."<br>";
+                $viewmodel->messages['info'] .= "Reload the latest text ";
                 $viewmodel->GetInfoFromPreviousPage($this->postdata);
                 $viewmodel->ReloadSetting();    // set file_id = current_fileId, current_fileId = 0
                 $viewmodel->GetTextFromFileId();
@@ -46,7 +46,7 @@
                 break;
 
             case 'ContinueTagging':
-                $viewmodel->messages['info'] .= "(Countinue tagging) "."<br>";
+                $viewmodel->messages['info'] .= "(Countinue tagging) ";
                 if ($this->postdata['topic']) {
                     $viewmodel->SetTopic($this->postdata['topic']);
                 }
@@ -56,7 +56,7 @@
 
 
             default:    // first time visit extraction interface from LGService
-                $viewmodel->messages['info'] .= "Welcome to Extraction Interface. "."<br>";
+                $viewmodel->messages['info'] .= "Welcome to Extraction Interface. ";
 
                 if ($this->postdata['fileId'] != 0) { // ($this->postdata['branchId'] != 0) {
                     // get text from fileId, from LGService
--- a/models/extractapp.php	Tue Mar 31 10:59:52 2015 +0200
+++ b/models/extractapp.php	Tue Mar 31 11:32:25 2015 +0200
@@ -178,35 +178,7 @@
         
 
     }
-    /*
-    public function Reload($_postdata) {
-
-        // update text using $this->current_fileId
-        // getTextbyFileId
-        $current_fileId = $_postdata['currentFileId'];
-        //$this->file_id = $_postdata['currentFileId'];
-        //$this->GetTextFromFileId($_postdata);
-        //$latest_editing = $this->lg_text;
-        // get from URL with file_id
-
-        $lg_text_url = $this->get_text_from_fileId_url.$current_fileId;
-        $lg_text = file_get_contents($lg_text_url);
-
-        $stringInput = $lg_text;
-        $stringInput = preg_replace("/ /u", "○", $stringInput);
-        $stringInput = preg_replace("/\n/u", "<br>", $stringInput);
-        $stringInput = preg_replace("/【(.*?)】/u", "【<a href=\"review_index_xml_images.php?books_id=".$bookId."&pages=\\1&entry=0\" target=\"_bookImg\">\\1</a>】", $stringInput);
-        $lg_text = $stringInput;
-
-
-        //var_dump($lg_text);
-
-        echo json_encode($lg_text);
-        //var_dump($this->file_id);
-
-    }
-    */
-
+  
 
     // TODO: comparison not correct
     private function Taglist_infileUpToDate($taglistArray) {
@@ -480,7 +452,7 @@
 
         } else {
             // -- new branch case
-            echo "saveNew!";
+            // echo "saveNew!";
             $user_id = "0";
             if ($_postdata['userId']) {
                 $user_id = $_postdata['userId'];
--- a/views/Extractapp/TaggingText.php	Tue Mar 31 10:59:52 2015 +0200
+++ b/views/Extractapp/TaggingText.php	Tue Mar 31 11:32:25 2015 +0200
@@ -933,9 +933,10 @@
 
 <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-warning" style=""> <?php echo $messages['warning']; ?> 
+        <button id="reloadTextButton" onclick="reloadText(<?php echo $default_topic_id; ?>)" style="display:none;">Load Latest Version</button>
+    </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>
@@ -987,7 +988,7 @@
                     <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>
+                            <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="">Manage Tags in topic</button></br>
                     </fieldset>