changeset 104:e542b161d907 extractapp

bug fixed: for only lowercase accepted in html tag.
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Fri, 05 Aug 2016 13:34:55 +0200
parents 2cc65ff46174
children 4eb62953af99
files controllers/extractapp.php models/extractapp.php views/Extractapp/EditTaglist.php views/Extractapp/TaggingText.php
diffstat 4 files changed, 29 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/controllers/extractapp.php	Mon Jul 25 17:10:16 2016 +0200
+++ b/controllers/extractapp.php	Fri Aug 05 13:34:55 2016 +0200
@@ -82,7 +82,9 @@
                     $viewmodel->messages['info'] .= "SaveFullTextToLGService! ";
                     $viewmodel->SetInfoFromPreviousPage($this->postdata);
                     $response = $viewmodel->SaveFullTextToLGService($this->postdata);
+
                     $viewmodel->UpdateInfoResponsedFromLGService($response);    // update file_id, branch_id, user_id
+                    
                     $viewmodel->SetTextFromFileId();     
                 }
                 $this->ReturnView($viewmodel->StartTagging(), true); 
--- a/models/extractapp.php	Mon Jul 25 17:10:16 2016 +0200
+++ b/models/extractapp.php	Fri Aug 05 13:34:55 2016 +0200
@@ -408,6 +408,7 @@
 
     }
 
+
     public function UpdateInfoResponsedFromLGService($response) {
         /**
          * 
@@ -431,9 +432,11 @@
             $this->messages['error'] .= "[Error] Saving Failed! ".(string)$response["message"]."<br>";
             $this->messages['warning'] .= "[Warning] Please check branch ".$this->branch_id." in LGService, and modify from the latest version.";
 
+            // TODO shouldnt reload latest file from the LGService...
+            // pass the orignal text?
+
             $response_currentFile = $response["currentFile"];
             $this->current_fileId = (string)$response_currentFile["id"];
-
         }
         
 
@@ -1295,7 +1298,14 @@
         $result = $this->GetTopicById($topic_id);
         $row = mysql_fetch_assoc($result);
         $tag = $row['tag'];
-        return $tag;
+
+        // TODO need to reconstruct the structure for topic tag considering user may use Uppercase but only lowercase accpetable in html tag that why we store only lowercase in Taglist.tag field in database table.
+        // Temporate solution is we replace " " with "_" and .lowercase(), which are as the same as we do in LGServices when create a topic and also create the correpsonding topic tag
+        
+        $tag = str_replace(' ', '_', $tag);
+        return strtolower($tag);
+
+        //return $tag;
     }
     private function GetTopicName($topic_id) {
         $result = $this->GetTopicById($topic_id);
--- a/views/Extractapp/EditTaglist.php	Mon Jul 25 17:10:16 2016 +0200
+++ b/views/Extractapp/EditTaglist.php	Fri Aug 05 13:34:55 2016 +0200
@@ -64,7 +64,7 @@
 	
 	console.log(".englishOnly");
 
-	var englishAlphabet =/[A-Za-z0-9]/g;
+	var englishAlphabet =/[a-z0-9]/g;
 
 	var key = String.fromCharCode(event.which);
 	
@@ -82,7 +82,7 @@
 	}	
 
 
-	alert("Please type in English characters.");
+	alert("Please type in (lowercase) English characters.");
 	
 	$(this).val(""); 
 
@@ -445,7 +445,7 @@
 	newTextBox.setAttribute("size","20");
 	
 	newTextBox.setAttribute("class","englishOnly");
-	newTextBox.setAttribute("placeholder","English characters only");
+	newTextBox.setAttribute("placeholder","Lowercase English characters only");
 	
 	this.appendChild(newTextBox).value=startPageValue;
 	
--- a/views/Extractapp/TaggingText.php	Mon Jul 25 17:10:16 2016 +0200
+++ b/views/Extractapp/TaggingText.php	Fri Aug 05 13:34:55 2016 +0200
@@ -381,8 +381,13 @@
 
                 console.log(selection);
 
+                console.log(JSON.parse('<?php echo json_encode($taglistArray) ?>'));
+                
+                console.log(JSON.parse('<?php echo json_encode($topic_tag) ?>'));
+
 
                 <?php 
+
                 foreach ( $taglistArray as $taglistValue ) {
                     if ($taglistValue[2] == $topic_tag) {
                     	echo "tagging_tags.innerHTML += \"<button accesskey=\\\"1\\\" onclick=\\\"tagwithOnlytag( range, selection, '".$taglistValue[2]."2' )\\\">".$taglistValue[1]."</button>\";\n";
@@ -912,8 +917,9 @@
     var topic_tag2 = topic_tag+"2";
 
     var documentFragment = range.extractContents();
-        
     
+    console.log("topic_tag: "+ topic_tag + ", topic_tag2: " + topic_tag2);
+
     var stringSelection = ""
     var childNodes = documentFragment.childNodes
     for (var i = 0; i < childNodes.length; i++){
@@ -924,6 +930,11 @@
         }
         
     }
+
+
+    //console.log("stringSelection: " + stringSelection);
+
+
     range.deleteContents();
 
     if ( tag==topic_tag2) {