phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] sync/inc/class.bo_sync.inc.php, 1.55


From: nomail
Subject: [Phpgroupware-cvs] sync/inc/class.bo_sync.inc.php, 1.55
Date: Tue, 6 Jul 2004 12:11:40 +0200

Update of /sync/inc
Modified Files:
        Branch: 
          class.bo_sync.inc.php

date: 2004/07/06 10:11:40;  author: mleonhardt;  state: Exp;  lines: +57 -6

Log Message:
- removed unused deleteClientMappings function
- documentation
- extended conflicthandling-ui
=====================================================================
Index: sync/inc/class.bo_sync.inc.php
diff -u sync/inc/class.bo_sync.inc.php:1.54 sync/inc/class.bo_sync.inc.php:1.55
--- sync/inc/class.bo_sync.inc.php:1.54 Thu Jul  1 08:46:44 2004
+++ sync/inc/class.bo_sync.inc.php      Tue Jul  6 10:11:40 2004
@@ -648,8 +648,7 @@
                        $conflictmimetype = 'x-phpgroupware/' . $modulename . 
'-show-data-array'; 
 
                        $gdata = $this->ipc->getdata($GUID, $conflictmimetype);
-                       $ldata = $this->ipc->convertdata(base64_decode($ldata), 
'text/vcard', '3.0', $conflictmimetype, '');
-//                     $ldata = unserialize(base64_decode($ldata));
+                       $ldata = 
$this->ipc->convertdata(unserialize(base64_decode($ldata)), 'x-phpgroupware/' . 
$modulename . '-appl-data-array', '', $conflictmimetype, '');
                        
                        $result = array();
       foreach($gdata as $gdata_array)
@@ -682,11 +681,11 @@
    *
    * @param integer $deviceid unique device ID for internal devices database
    * @param string $source Source name from device (e.g. 'contacts')
-   * @param string $LUID local identifier of a record in the source (local 
recordid of the syncdevice)
+    * @param integer $conflictid unique conflict ID of table 
phpgw_syncconflicts     
    * @param string $ldata data value of the record from the device 
    * @return integer >= 0 if successfull, < 0 in case of error  
-   * @param integer $deviceid thats name is requested
    */
+   
    function ConvertAndAddConfict($deviceid, $source, $LUID, $LData)
    {
      // get the responsible IPC class
@@ -699,7 +698,7 @@
      
      $mimetype = 
$session_data['sync_currentsourceinfo']['contentType.RX.type'];
      $mimeversion = 
$session_data['sync_currentsourceinfo']['contentType.RX.version'];
-     $typeOut = "x-phpgroupware/$source-show-data-array";
+     $typeOut = "x-phpgroupware/$source-appl-data-array";
     
      $data = $this->ipc->convertData($LData, $mimetype, $mimeversion, 
$typeOut, '1.0');
      if (!isarray($data)) 
@@ -712,6 +711,58 @@
      return $this->so->AddConfict($deviceid, $source, $LUID, $data);
    }
      
+       /**
+   * Solve conflict with conflictid
+   *
+   * @param integer $deviceid unique device ID for internal devices database
+   * @param string $source Source name from device (e.g. 'contacts')
+   * @param string $LUID local identifier of a record in the source (local 
recordid of the syncdevice)
+   * @param string $ldata data value of the record from the device 
+   * @return integer >= 0 if successfull, < 0 in case of error  
+   */
+   
+   function SaveSolvedConflict($deviceid, $source, $conflictid, $action)
+   {
+         if ($this->debug)
+                       error_log("SaveSolvedConflict($deviceid, $source, 
$conflictid, $action)");
+                       
+               $result = -1;
+               
+       // get the responsible IPC class
+       $modulename = $this->GetIpcforSource($source);
+       if (!isset($this->ipc) or ($this->ipc == false)) 
+       {
+       error_log("Sync Module: Error: There is no source called '$source'. Can 
not synchronize");
+       return -1;
+       }     
+     
+       // get conflict
+       $conflict = $this->so->GetConflict($deviceid, $source, $conflictid);
+       $LUID = $conflict[2];
+       $ldata = $conflict[3];
+
+                       $GUID = $this->so->getGUIDExt($deviceid, $source, 
$LUID);
+                       $conflictmimetype = 'x-phpgroupware/' . $modulename . 
'-appl-data-array'; 
+
+                       if ($action == 'server')
+                       {
+                               $gdata = $this->ipc->getdata($GUID, 
$conflictmimetype);
+                               // set new data to get actual timestamp -> 
update client on next sync
+                               $result = $this->ipc->replaceData($GUID, 
$gdata, $conflictmimetype, '', time());
+                       }
+                       else
+                       {
+       //                      $ldata = 
$this->ipc->convertdata(base64_decode($ldata), 'text/vcard', '3.0', 
$conflictmimetype, '');
+                               $ldata = unserialize(base64_decode($ldata));
+                               $result = $this->replaceData($GUID, $ldata, 
$conflictmimetype, '', time());
+                       }
+       
+       if ($result >= -1)
+         $result = $this->so->DeleteConflict($deviceid, $source, $conflictid);
+         
+       return $result;
+   }
+     
  
   }
 ?> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]