comparison models/extractapp.php @ 57:5cf9720a2e25 extractapp

New: add reloadText to load the latest version
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Mon, 30 Mar 2015 17:23:47 +0200
parents 95f929d7b318
children a11f9103b8db
comparison
equal deleted inserted replaced
56:95f929d7b318 57:5cf9720a2e25
346 $response_file = $response["file"]; 346 $response_file = $response["file"];
347 $response_branch = $response["branch"]; 347 $response_branch = $response["branch"];
348 348
349 $status = (string)$response["status"]; 349 $status = (string)$response["status"];
350 if ($status == "ok") { 350 if ($status == "ok") {
351 $this->messages .= "saving success."; 351 $this->messages .= "Saving success.";
352 $this->file_id = (string)$response_file["id"]; 352 $this->file_id = (string)$response_file["id"];
353 $this->branch_id = (string)$response_branch["id"]; 353 $this->branch_id = (string)$response_branch["id"];
354 354
355 } else if ($status == "error") { 355 } else if ($status == "error") {
356 // saving not success 356 // saving not success
357 $this->messages .= "saving does not success! ".(string)$response["message"]; 357 $this->messages .= "Saving Failed! ".(string)$response["message"]."<br>";
358 $this->messages .= "Please check branch ".$this->branch_id." in LGService, and modify from the latest version. <br>";
359
358 $response_currentFile = $response["currentFile"]; 360 $response_currentFile = $response["currentFile"];
359 //$this->current_fileId = $response["currentFileId"]; 361 //$this->current_fileId = $response["currentFileId"];
360 $this->current_fileId = (string)$response_currentFile["id"]; 362 $this->current_fileId = (string)$response_currentFile["id"];
361 363
362 } 364 }
363 365
364 366
365 } 367 }
368
369 public function ReloadSetting() {
370 if ($this->current_fileId != 0) {
371 $this->file_id = $this->current_fileId;
372 $this->current_fileId = 0;
373 }
374 }
375
366 private function AppendMetaData($text_content) { 376 private function AppendMetaData($text_content) {
367 $text = '<?xml version="1.0" encoding="UTF-8"?>'; 377 $text = '<?xml version="1.0" encoding="UTF-8"?>';
368 $text .= "\n<text>\n"; 378 $text .= "\n<text>\n";
369 // topic 379 // topic
370 $text .= "<topic>".$this->topic."</topic>\n"; 380 $text .= "<topic>".$this->topic."</topic>\n";