# HG changeset patch # User Zoe Hong # Date 1430383925 -7200 # Node ID 0141df465205e07ab0884a25c1b1c8d0ce537bed # Parent 966a36752c342f796801a1a49b90c536a8b19cb1 New: add chinese characters to pinyin diff -r 966a36752c34 -r 0141df465205 controllers/extractapp.php --- a/controllers/extractapp.php Thu Apr 23 17:08:31 2015 +0200 +++ b/controllers/extractapp.php Thu Apr 30 10:52:05 2015 +0200 @@ -66,11 +66,20 @@ $this->ReturnView($viewmodel->StartTagging(), true); break; case 'SaveFullTextToLGService': - $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(); + global $AT_LOCAL; + if ($AT_LOCAL) { + $viewmodel->messages['info'] .= "SaveFullTextToLGService! (local test) "; + $viewmodel->SetInfoFromPreviousPage($this->postdata); + $response = $viewmodel->SaveFullTextToLGService($this->postdata); + + } else { + + $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); break; diff -r 966a36752c34 -r 0141df465205 css/taggingtext.css --- a/css/taggingtext.css Thu Apr 23 17:08:31 2015 +0200 +++ b/css/taggingtext.css Thu Apr 30 10:52:05 2015 +0200 @@ -13,6 +13,23 @@ .bg-default{ background-color: #F4F4F4; } +.btn-xs{ + height: 25px; + width: 60px; +} +.btn-sm{ + height: 35px; + width: 70px; +} +.btn-md{ + height: 35px; + width: 110px; +} +.btn-lg{ + height: 35px; + width: 220px; +} + .info-board{ margin:10 30 10 30; diff -r 966a36752c34 -r 0141df465205 models/extractapp.php --- a/models/extractapp.php Thu Apr 23 17:08:31 2015 +0200 +++ b/models/extractapp.php Thu Apr 30 10:52:05 2015 +0200 @@ -76,11 +76,38 @@ $section_meta = json_decode(file_get_contents($section_meta_url), true); $b = $section_meta['section']['book']; - + + $this->book_name = $b['name']; + $this->book_id = $b['id']; + /* $book_meta = array(); array_push($book_meta, array($b['id'],$b['name'],$b['level1'],$b['level2'], $b['period'],$b['dynasty'], $b['start_year'], $b['end_year'],$b['line'], $b['volume'],$b['author'], $b['edition'],$b['in_jibengujiku'], $b['admin_type'])); // missing author,year,pagenumber + */ + /* + $book_meta = array('id'=>$b['id'],'name'=>$b['name'],'level1'=>$b['level1'],'level2'=>$b['level2'], + 'period'=>$b['period'],'dynasty'=>$b['dynasty'],'start_year'=>$b['start_year'], 'end_year'=>$b['end_year'],'line'=>$b['line'], + 'volume'=>$b['volume'],'author'=>$b['author'],'edition'=>$b['edition'], + 'in_jibengujiku'=>$b['in_jibengujiku'],'admin_type'=>$b['admin_type']); // missing author,year,pagenumber + */ + + $book_meta->id = $b['id']; + $book_meta->name = $b['name']; + $book_meta->level1 = $b['level1']; + $book_meta->level2 = $b['level2']; + $book_meta->period = $b['period']; + $book_meta->dynasty = $b['dynasty']; + $book_meta->start_year = $b['start_year']; + $book_meta->end_year = $b['end_year']; + $book_meta->line = $b['line']; + $book_meta->volume = $b['volume']; + $book_meta->author = $b['author']; + $book_meta->edition = $b['edition']; + $book_meta->in_jibengujiku = $b['in_jibengujiku']; + $book_meta->admin_type = $b['admin_type']; + + $this->book_meta = $book_meta; } @@ -213,7 +240,7 @@ return true; } - + // === for tagging === public function StartTagging() { /** @@ -229,7 +256,7 @@ //$taglistArray = $this->GetTaglistArray(); //for GetTaglistByTopicId: $taglistArray = $this->GetTaglistByTopicId($this->GetTopic()); - + // $this->taglist_infile is set (1) from file or (2) from _postdata['taglistArray'] which comes from frontend that user decided // $this->taglist_infile is the most up-to-date taglist decided by user. Should be written into file. if( $this->TaglistSubsetIn($this->taglist_infile, $taglistArray) ) { // TaglistSubsetIn($l1,$l2): $l1 is a subset of $l2 or not @@ -253,13 +280,16 @@ $data['section_id'] = $section_id; $data['topiclistArray'] = $topiclistArray; $data['default_topic_id'] = $this->GetTopic(); - $data['topic_tag'] = $this->GetTopicTag($this->GetTopic()); - $data['topic_name'] = $this->GetTopicName($this->GetTopic()); + $topic_id = $this->GetTopic(); + + $data['topic_tag'] = $this->GetTopicTag($topic_id); + $data['topic_name'] = $this->GetTopicName($topic_id); + $data['topic_tag_ch'] = $this->GetTopicTagName($topic_id); $data['info'] = array('file_id'=>$this->file_id, 'user_id'=>$this->user_id, 'branch_id'=>$this->branch_id, 'section_id'=>$this->section_id, 'book_id'=>$this->book_id, - 'book_name'=>$this->book_name, 'section_name'=>$this->section_name, + 'book_name'=>$this->book_name,'section_name'=>$this->section_name, 'period'=>$this->book_meta->period, 'current_fileId'=>$this->current_fileId); $this->messages['debug'] .= "[Debug] "; @@ -272,6 +302,7 @@ $this->messages['info'] .= ", section id: ". $this->section_id; $this->messages['info'] .= ", branch id: ".$this->branch_id; $this->messages['info'] .= ", file id: ".$this->file_id; + $this->messages['info'] .= ", period: ".$this->book_meta->period; $this->messages['info'] .= "
"; @@ -308,10 +339,9 @@ public function UpdateInfoResponsedFromLGService($response) { /** - * + * */ - if (isset($response["file"])) { $response_file = $response["file"]; } @@ -353,6 +383,26 @@ $text .= "".$this->topic."\n"; // --- book meta data --- $book = $this->book_meta; + + $text .= "\n"; + $text .= "".$book->id."\n"; + $text .= "".$book->name."\n"; + $text .= "".$book->level1."\n"; + $text .= "".$book->level2."\n"; + $text .= "".$book->period."\n"; + $text .= "".$book->dynasty."\n"; + $text .= "".$book->start_year."\n"; + $text .= "".$book->end_year."\n"; + $text .= "".$book->line."\n"; + $text .= "".$book->volume."\n"; + $text .= "".$book->author."\n"; + $text .= "".$book->edition."\n"; + $text .= "".$book->in_jibengujiku."\n"; + $text .= "".$book->admin_type."\n"; + $text .= "\n"; + + + /* foreach ($book as $b) { $text .= "\n"; $text .= "".$b[0]."\n"; @@ -372,6 +422,8 @@ $text .= "\n"; } + */ + // --- section info --- $text .= "
\n"; $text .= "".$this->section_id."\n"; @@ -1086,7 +1138,6 @@ $row = mysql_fetch_assoc($result); $tag = $row['tag']; return $tag; - } private function GetTopicName($topic_id) { $result = $this->GetTopicById($topic_id); @@ -1094,10 +1145,19 @@ //$name = $row['name']; $name = array('name_en'=>$row['name_en'], 'name_ch'=>$row['name_ch'], 'name_pinyin'=>$row['name_pinyin']); return $name; + } + private function GetTopicTagName($topic_id) { + $topic_tag = $this->GetTopicTag($topic_id); + $query = "SELECT * FROM `taglist` WHERE tag='".$topic_tag."'"; + $result = mysql_query($query); + $row = mysql_fetch_assoc($result); + return $row['name']; } + + // =========================== // === for manage wordlist === @@ -1290,6 +1350,8 @@ $bookId = $section_info['bookId']; $startPage = $section_info['startPage']; $endPage = $section_info['endPage']; + $this->section_name = $section_info['sectionName']; + $contentString=""; $data_path = $this->GetDataPath(); diff -r 966a36752c34 -r 0141df465205 views/Extractapp/TaggingText.php --- a/views/Extractapp/TaggingText.php Thu Apr 23 17:08:31 2015 +0200 +++ b/views/Extractapp/TaggingText.php Thu Apr 30 10:52:05 2015 +0200 @@ -40,6 +40,7 @@ $default_topic_id = $viewmodel['default_topic_id']; $topic_name = $viewmodel['topic_name']; // array of names $topic_tag = $viewmodel['topic_tag']; +$topic_tag_ch = $viewmodel['topic_tag_ch']; $info = $viewmodel['info']; $messages = $viewmodel['messages']; @@ -53,7 +54,9 @@ Extraction Interface - + + +