diff develop/models/extractapp.php @ 26:579f03f8bee5

merge table books_info into table books (execute Home/Test)
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 03 Mar 2015 10:33:42 +0100
parents 4b6d2d7e706e
children 4a29bccb6c59
line wrap: on
line diff
--- a/develop/models/extractapp.php	Mon Mar 02 16:16:54 2015 +0100
+++ b/develop/models/extractapp.php	Tue Mar 03 10:33:42 2015 +0100
@@ -192,7 +192,11 @@
         $data['topic_tag'] = $this->GetTopicTag($this->GetTopic());
         $data['topic_name'] = $this->GetTopicName($this->GetTopic());
 
-        $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);
+        $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,
+                'current_fileId'=>$this->current_fileId);
+        
         $data['messages'] = $this->messages;
 
         return $data;
@@ -240,7 +244,8 @@
         } else if ($status == "error") {
             // saving not success
             $this->messages .= "saving does not success! ".(string)$response["message"];
-        
+            $this->current_fileId = (string)$response['currentFileId'];
+            // ask to "force save" or "reload"
 
         }
         
@@ -279,7 +284,6 @@
         if ($_postdata['branchId'] != 0) {
             // exiting branch case
             $postfields = array(
-                //"text" => $_postdata['text'], 
                 "text" => $require, 
                 "branchId" => $_postdata['branchId'],
                 "userId" => $_postdata['userId'],
@@ -296,22 +300,15 @@
                 $user_id = "12";
             }
             $postfields = array(
-                //"text" => $_postdata['text'], 
                 "text" => $require, 
                 "sectionId" => $_postdata['sectionId'],
-                //"userId" => $_postdata['userId'],
-                // TODO: change userId when we can query by sectionId from LGService using search
                 "userId" => $user_id,
                 "label" => $_postdata['label'],
-                // TODO: ask user for lable
-                //"label" => "label for section ".$_postdata['sectionId'],
             ); 
             $save_url = $this->save_new_to_LGService_url;
         }   
 
         
-
-        
         // set up the curl resource
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $save_url);