# HG changeset patch # User Zoe Hong # Date 1428502670 -7200 # Node ID 2daef8e36214d50a0c371d01720c114bed5370bb # Parent 6974309983d1daf21422252773eac24600e69b82 minor modification diff -r 6974309983d1 -r 2daef8e36214 controllers/extractapp.php --- 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 --- diff -r 6974309983d1 -r 2daef8e36214 models/extractapp.php --- 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", "
", $stringInput); - $stringInput = preg_replace("/【(.*?)】/u", "【\\1】", $stringInput); + $stringInput = preg_replace("/【(.*?)】/u", "【book_id."&pages=\\1&entry=0\" target=\"_bookImg\">\\1】", $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") {