changeset 65:f9ae94a9b041 extractapp

New: adding topic names: name_en, name_ch, name_pinyin
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Thu, 02 Apr 2015 11:45:09 +0200
parents ca6bf3532830
children e71a437ae49f
files css/taggingtext.css js/taggingtext.js models/extractapp.php views/Extractapp/ConfigTagsInTopic.php views/Extractapp/TaggingText.php
diffstat 5 files changed, 30 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/css/taggingtext.css	Wed Apr 01 15:13:37 2015 +0200
+++ b/css/taggingtext.css	Thu Apr 02 11:45:09 2015 +0200
@@ -18,6 +18,8 @@
 
 .info-board{
 	margin:10 30 10 30;
+	border: 2px solid #A1A1A1;
+    border-radius: 4px;
 	max-width:1270;
 	height:70px;
 	overflow:scroll;
--- a/js/taggingtext.js	Wed Apr 01 15:13:37 2015 +0200
+++ b/js/taggingtext.js	Thu Apr 02 11:45:09 2015 +0200
@@ -208,8 +208,8 @@
     newdiv.id = "questionMarkId";
     newdiv.setAttribute("class", "questionMarkClass");
 
-    // set z-index to 4 to bring popup tag windwo to front
-    newdiv.style.cssText = 'top:'+eventObject.pageY+'; left:'+eventObject.pageX+'; position:absolute; background-color: white; border:1px solid black; padding: 5px; z-index:4';
+    // set z-index to 3 to bring popup tag windwo to front
+    newdiv.style.cssText = 'top:'+eventObject.pageY+'; left:'+eventObject.pageX+'; position:absolute; background-color: white; border:1px solid black; padding: 5px; z-index:3';
     newdiv.innerHTML = "Tag: "+tagName+"<br>Value: "+tagObject.text()+"<br>";
     
     var newbutton = $('<button>Remove this</button>').mouseup(function (e2) {
--- a/models/extractapp.php	Wed Apr 01 15:13:37 2015 +0200
+++ b/models/extractapp.php	Thu Apr 02 11:45:09 2015 +0200
@@ -316,7 +316,7 @@
         
         // text_content
         $text .= $text_content;
-        $text .= "\n</text>";
+        $text .= "</text>";
 
         return $text;
     }
@@ -350,7 +350,7 @@
 
             if ($_postdata['branchId'] == 0) {
                 // -- new branch case
-                $require = "<text_content>\n".$require."</text_content>\n";
+                $require = "<text_content>".$require."</text_content>\n";
             }
             $require = $this->AppendMetaData($require);
                 
@@ -739,7 +739,9 @@
         $topic = $postdata['topic'];
         $result = $this->GetTopicByID($topic);
         $row = mysql_fetch_assoc($result);
-        $topic_name = $row['name'];
+        $topic_name_en = $row['name_en'];
+        $topic_name_ch = $row['name_ch'];
+        $topic_name_pinyin = $row['name_pinyin'];
 
         /*
         $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`";
@@ -813,7 +815,7 @@
         $data = array();
         //$data['taglistArray'] = $taglistArray;
         $data['topic'] = $topic;
-        $data['topic_name'] = $topic_name;
+        $data['topic_name'] = array('name_en'=>$topic_name_en,'name_ch'=>$topic_name_ch,'name_pinyin'=>$topic_name_pinyin);
 
         $data['tag_intopic'] = $tag_intopic;
         $data['tag_others'] = $tag_others;
@@ -964,7 +966,8 @@
         $topiclistArray = array();
         $result = $this->GetTopiclist();
         while ($row = mysql_fetch_assoc($result)) {
-            array_push($topiclistArray, array('id'=>$row['id'],'name'=>$row['name'],'tag'=>$row['tag']));
+            //array_push($topiclistArray, array('id'=>$row['id'],'name'=>$row['name'],'tag'=>$row['tag']));
+            array_push($topiclistArray, array('id'=>$row['id'],'tag'=>$row['tag'],'name_en'=>$row['name_en'],'name_ch'=>$row['name_ch'],'name_pinyin'=>$row['name_pinyin'],));
         }
         return $topiclistArray;
     }
@@ -980,7 +983,8 @@
     private function GetTopicName($topic_id) {
         $result = $this->GetTopicByID($topic_id);
         $row = mysql_fetch_assoc($result);
-        $name = $row['name'];
+        //$name = $row['name'];
+        $name = array('name_en'=>$row['name_en'], 'name_ch'=>$row['name_ch'], 'name_pinyin'=>$row['name_pinyin']);
         return $name;
 
     }
--- a/views/Extractapp/ConfigTagsInTopic.php	Wed Apr 01 15:13:37 2015 +0200
+++ b/views/Extractapp/ConfigTagsInTopic.php	Thu Apr 02 11:45:09 2015 +0200
@@ -2,7 +2,7 @@
 // --- initialize ---
 //$taglistArray = $viewmodel['taglistArray'];
 $topic = $viewmodel['topic'];
-$topic_name = $viewmodel['topic_name'];
+$topic_name = $viewmodel['topic_name']; // array of names
 $tag_intopic = $viewmodel['tag_intopic'];
 $tag_others = $viewmodel['tag_others'];
 
@@ -88,7 +88,7 @@
 <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;?> </h3>
+			<h3>Topic: <?php echo $topic_name['name_en'];?> (<?php echo $topic_name['name_ch'];?>, <?php echo $topic_name['name_pinyin'];?>) </h3>
 			
 			<table class="table">
 				<thead>
--- a/views/Extractapp/TaggingText.php	Wed Apr 01 15:13:37 2015 +0200
+++ b/views/Extractapp/TaggingText.php	Thu Apr 02 11:45:09 2015 +0200
@@ -6,7 +6,7 @@
 $section_id = $viewmodel['section_id'];
 $topiclistArray = $viewmodel['topiclistArray'];
 $default_topic_id = $viewmodel['default_topic_id'];
-$topic_name = $viewmodel['topic_name'];
+$topic_name = $viewmodel['topic_name']; // array of names
 $topic_tag = $viewmodel['topic_tag'];
 $info = $viewmodel['info']; 
 $messages = $viewmodel['messages'];
@@ -236,10 +236,8 @@
     	var newdiv = document.createElement("div");
         newdiv.id = "tagItemDivId";
         newdiv.setAttribute("class", "tagItemDivClass");
-        newdiv.style.cssText = 'top:'+e.pageY+'; left:'+e.pageX+'; position:absolute; background-color: white; border:1px solid black; padding: 5px';
+        newdiv.style.cssText = 'top:'+e.pageY+'; left:'+e.pageX+'; position:absolute; background-color: white; border:1px solid black; padding: 5px; z-index:4';
         
-        newdiv.style.backgroundColor = "white";
-        newdiv.style.zIndex = "3";
 
         //console.log(selection.getRangeAt(0).cloneContents());
         if ( container.innerHTML.indexOf( "br" ) != -1 ) {
@@ -671,10 +669,10 @@
     
     $('#load_topic_div').css("border", "1px solid black");
     $('#load_topic_div').css("background-color", "White");
-    $('#load_topic_div').css("width", "150px");
+    $('#load_topic_div').css("width", "200px");
     $('#load_topic_div').css("height", "50px");
     $('#load_topic_div').css("top", "20px");
-    $('#load_topic_div').css("left", "-150px");
+    $('#load_topic_div').css("left", "-200px");
     
 
     var topic_select = document.createElement("select");
@@ -709,10 +707,10 @@
 
     //Create and append the options
 	for (var i = 0; i < t.length; i++) {
-		console.log(t[i]['id']+","+t[i]['name']);
+		console.log(t[i]['id']+","+t[i]['name_ch']+","+t[i]['name_pinyin']+","+t[i]['name_en']);
     	var option = document.createElement("option");
     	option.value = t[i]['id'];
-	    option.text = t[i]['name'];
+	    option.text = t[i]['name_en']+" ("+t[i]['name_ch']+", "+t[i]['name_pinyin']+")";
 	    if (option.value == default_topic_id) {
 	    	option.selected = true;
 	    };
@@ -865,15 +863,15 @@
 </div>
 
 <div class="info-board">
-    <p class="bg-danger"><strong><?php echo $messages['error']; ?> </strong></p>
-    <p class="bg-warning"> <?php echo $messages['warning']; ?> 
+    <div class="bg-danger"><strong><?php echo $messages['error']; ?> </strong></div>
+    <div class="bg-warning"> <?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-info"> <?php echo $messages['info']; ?> </p>
-    <p class="bg-default"> <?php echo $messages['debug']; ?> </p>
+    </div>
+    <div class="bg-info"> <?php echo $messages['info']; ?> </div>
+    <div class="bg-default"> <?php echo $messages['debug']; ?> </div>
 </div>
 
-<table width="1270" border="1" style="margin:10 30 10 30;">
+<table width="1270" border="1" style="margin:10 30 30 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>
@@ -919,7 +917,8 @@
                 <form action="javascript:void(0);">   
                     <fieldset>
                         <legend><h5 class="text-success"> Config Topic: </h5></legend>
-                        <div> current topic is <?php echo $topic_name; ?> 
+                        <div> current topic is: <?php echo $topic_name['name_en']; ?> <br>
+                            (<?php echo $topic_name['name_ch']; ?>, <?php echo $topic_name['name_pinyin']; ?>)
                             <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>