Mercurial > hg > extraction-interface
changeset 73:2daef8e36214 extractapp
minor modification
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 08 Apr 2015 16:17:50 +0200 |
parents | 6974309983d1 |
children | 60b5a94163c3 |
files | controllers/extractapp.php models/extractapp.php |
diffstat | 2 files changed, 14 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/controllers/extractapp.php Wed Apr 08 15:45:53 2015 +0200 +++ b/controllers/extractapp.php Wed Apr 08 16:17:50 2015 +0200 @@ -60,11 +60,13 @@ default: // first time visit extraction interface from LGService $viewmodel->messages['info'] .= "Welcome to Extraction Interface. "; - if ($this->postdata['fileId'] != 0) { // ($this->postdata['branchId'] != 0) { - // --- Existing branch case --- - $viewmodel->GetInfoFromPreviousPage($this->postdata); - // get text by fileId, from LGService - $viewmodel->GetTextFromFileId(); + if (isset($this->postdata['fileId'])) { + if ($this->postdata['fileId'] != 0) { // ($this->postdata['branchId'] != 0) { + // --- Existing branch case --- + $viewmodel->GetInfoFromPreviousPage($this->postdata); + // get text by fileId, from LGService + $viewmodel->GetTextFromFileId(); + } } else if ($this->postdata['sectionId'] != 0 && $this->postdata['userId'] != 0) { // --- New branch case ---
--- a/models/extractapp.php Wed Apr 08 15:45:53 2015 +0200 +++ b/models/extractapp.php Wed Apr 08 16:17:50 2015 +0200 @@ -84,13 +84,12 @@ $lg_text_url = $this->get_text_from_sectionId_url.$this->section_id; $lg_text = file_get_contents($lg_text_url); - $stringInput = $lg_text; $stringInput = preg_replace("/<(.*?)>/u", "○", $stringInput); $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); + $stringInput = preg_replace("/【(.*?)】/u", "【<a href=\"review_index_xml_images.php?books_id=".$this->book_id."&pages=\\1&entry=0\" target=\"_bookImg\">\\1</a>】", $stringInput); $lg_text = $stringInput; $this->lg_text = $lg_text; @@ -124,7 +123,6 @@ if (isset($_postdata['topic_id'])) { $this->topic = $_postdata['topic_id']; } - if (isset($_postdata['sectionName'])) { $this->section_name = $_postdata['sectionName']; } @@ -144,11 +142,9 @@ $this->book_meta = json_decode($_postdata['book_meta']); } - } - private function TaglistSubsetIn($list1, $list2) { // $l1 is a subset of $l2 or not // l1 and l2: array( $row['id'], $row['name'], $row['tag'], $row['color'] ) $cnt_list1 = count($list1); @@ -274,8 +270,12 @@ public function UpdateInfoByResponseFromLGService($response) { - $response_file = $response["file"]; - $response_branch = $response["branch"]; + if (isset($response["file"])) { + $response_file = $response["file"]; + } + if (isset($response["branch"])) { + $response_branch = $response["branch"]; + } $status = (string)$response["status"]; if ($status == "ok") {