phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] sync/inc/class.ui_sync.inc.php, 1.17


From: nomail
Subject: [Phpgroupware-cvs] sync/inc/class.ui_sync.inc.php, 1.17
Date: Sun, 23 May 2004 04:32:05 -0000

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

date: 2004/05/03 15:04:17;  author: mleonhardt;  state: Exp;  lines: +59 -31

Log Message:
- extended ui functionality (lastsync reset to fullsync works now)
- fixing deletedevice in ui
=====================================================================
Index: sync/inc/class.ui_sync.inc.php
diff -u sync/inc/class.ui_sync.inc.php:1.16 sync/inc/class.ui_sync.inc.php:1.17
--- sync/inc/class.ui_sync.inc.php:1.16 Mon May  3 08:14:11 2004
+++ sync/inc/class.ui_sync.inc.php      Mon May  3 15:04:17 2004
@@ -43,7 +43,8 @@
       'deletedevice' => True,
       'preferences' => True,
       'saveconflicthandling' => True,
-      'savedevicedescription' => True
+      'savedevicedescription' => True,
+      'resetchannel' => True
                );
 
     /**
@@ -60,19 +61,6 @@
     var $nextmatchs;
     
     /**
-     * @var     array   $conflictsolutions holds the mapping array
-     *                  ID (integer) to string of the supported handling 
-     *                  of conflicts
-     * @access  public
-     */
-     
-    var $conflictsolutions = array(
-      1 => 'serverwins', 
-      2 => 'clientwins', 
-      3 => 'duplicate', 
-      4 => 'donothing');
-   
-    /**
      * @var     boolean   $debug enable debug-infos
      * @access  public
      */
@@ -152,9 +140,7 @@
   {
     // get actual user ID
     $phpgw_userid = $GLOBALS['phpgw_info']['user']['account_id'];
-    //getallsyncsources()
-    $sources = array('appointments', 'Contacts', 'Kalender');
-    
+   
     // table header
     $this->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
     $this->template->set_var('last_sync_status',lang('last_sync_status'));
@@ -170,16 +156,20 @@
 
       // device
       foreach($devicelist as $device) {
+        $deviceid = $device[0];
         $this->template->set_var('lastsync_devicelabel', 
lang('sync_devicelabel'));
-        $this->template->set_var('lastsync_devicename', 
$this->bo->getDeviceName($device[0]));
+        $this->template->set_var('lastsync_devicename', 
$this->bo->getDeviceName($deviceid));
         $lastsynctable .= 
$this->template->fp('sync_template','lastsync_device');
 
+        $sources = $this->so->getUsedSources($deviceid);
+
         // table body
         foreach($sources as $source) {
           $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
           $this->template->set_var('tr_color', $tr_color);
-          $this->template->set_var('lastsync_source', $source);
-          $lasttimestamp = $this->so->GetTimestamp($device[0], $source);
+          $resetChannelLink = 
$GLOBALS['phpgw']->link('/index.php','menuaction=sync.ui_sync.resetchannel');
+          $this->template->set_var('resetchannelformaction', 
$resetChannelLink);
+          $lasttimestamp = $this->so->GetTimestamp($deviceid, $source);
           $lastsync = $lasttimestamp[0];
           if ($lastsync == 0) 
             $lastsync = lang('status_never');
@@ -187,7 +177,9 @@
 //            $lastsync = $GLOBALS['phpgw']->common->show_date($lastsync);
             $lastsync = $lastsync;
           $this->template->set_var('lastsync_lastsync', $lastsync);
-          $this->template->set_var('lastsync_fullsync', 'fullsync bla');
+          $this->template->set_var('deviceid', $deviceid);
+          $this->template->set_var('lastsync_source', $source);
+          $this->template->set_var('lastsync_fullsync', 
lang('lastsync_fullsync'));
           $lastsynctable .= 
$this->template->fp('sync_template','lastsync_list');
         }
 
@@ -201,6 +193,40 @@
   }
 
   /**
+   * Reset a source to get full sync, then show applications user interface.
+   *
+   * this public function
+   * loads the sync.tpl Template and shows the default init site of the sync 
module
+   * after resetting a channel and insert_lastsynctable (called by init) then 
shows the status
+   * @access  public
+   */
+  function resetchannel()
+  {
+    $success = false;
+    
+    // get posted variables
+    $deviceid = get_var('deviceid');
+    $source = get_var('source');
+
+    if (($deviceid != '') and ($source != ''))
+      $success = $this->so->resetChanneltoFullsync($deviceid, $source) >= 0;
+    
+    if ($success)
+    {
+      $status1 = lang('status_ok');
+      $status2 = '';
+    }
+    else
+    {
+      $status1 = lang('status_error');
+      $status2 = lang('status_not');
+    }   
+    $this->last_operation_status = sprintf(lang('status_resetdone'), $status1, 
$status2);
+    
+    $this->init();
+  }
+
+  /**
    * insert a link to the template that user can start the testcase
    *
    * @access  private
@@ -391,6 +417,7 @@
     $devicelist = array();
     if ($this->so->GetDeviceList($phpgw_userid, $devicelist)) {
       foreach($devicelist as $device) {
+        $deviceid = $device[0];
         $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
         $this->template->set_var('tr_color', $tr_color);
         $this->template->set_var('device_account', 
$GLOBALS['phpgw']->accounts->id2name($device[1]));
@@ -398,11 +425,11 @@
         $this->template->set_var('device_description', $device[3]);
         $this->template->set_var('descriptionsettingformaction', 
           
$GLOBALS['phpgw']->link('/index.php',"menuaction=sync.ui_sync.savedevicedescription"));
-        $this->template->set_var('deviceid', $device[0]);
+        $this->template->set_var('deviceid', $deviceid);
         $this->template->set_var('save', lang('save'));
         $this->template->set_var('device_username', $device[4]);
         $this->template->set_var('device_edit', 'edit');
-        $DeviceDeleteLink = 
$GLOBALS['phpgw']->link('/index.php','menuaction=sync.ui_sync.deletedevice&del_device_id='
 . urlencode($device[1]));
+        $DeviceDeleteLink = 
$GLOBALS['phpgw']->link('/index.php','menuaction=sync.ui_sync.deletedevice&del_device_id='
 . $deviceid);
         $this->template->set_var('DeviceDeleteLink',$DeviceDeleteLink);
         $this->template->set_var('device_delete', lang('delete'));
         $devicelisttable .= $this->template->fp('sync_template','device_list');
@@ -429,7 +456,7 @@
   function deletedevice()
   {
     $del_device_id = get_var('del_device_id');
-    if ($this->so->DeleteDevice($this->so->GetDeviceID($del_device_id)) >= 0)
+    if ($this->so->DeleteDevice($del_device_id) >= 0)
     {
       $status1 = lang('status_ok');
       $status2 = '';
@@ -439,7 +466,8 @@
       $status1 = lang('status_error');
       $status2 = lang('status_not');
     }   
-    $this->last_operation_status = sprintf(lang('status_deldevice'), $status1, 
$status2, $del_device_id);
+    $this->last_operation_status = sprintf(lang('status_deldevice'), 
+             $status1, $status2, $this->bo->getDeviceName($del_device_id));
     $this->listdevices();
   }
 
@@ -554,10 +582,10 @@
           // in case of readerror we use the default (3 = duplicate)
           if ($selectedid < 0) $selectedid = 3;
           // convert to 
-          $selected = $this->conflictsolutions[$selectedid];
+          $selected = $this->bo->conflictsolutions[$selectedid];
           $selectoptions = '';
-          reset($this->conflictsolutions);
-          foreach ($this->conflictsolutions as $solution)
+          reset($this->bo->conflictsolutions);
+          foreach ($this->bo->conflictsolutions as $solution)
           { 
             $selectedstring = $solution==$selected?' selected':'';
             $listtext = lang("conflict_$solution");
@@ -604,7 +632,7 @@
             error_log("conflict[$deviceid]_$source has type: $handlingtype");
           if ($handlingtype != '')
           {
-            reset($this->conflictsolutions);
+            reset($this->bo->conflictsolutions);
             while (list($solutionkey, $solution) = 
each($this->conflictsolutions)) {
               if ($solution == $handlingtype)
               {
@@ -649,7 +677,7 @@
     $newdescription = get_var('device_description_text');
 
     if ($deviceid != '')
-      $success = $this->so->setDeviceDescription($deviceid, $newdescription);
+      $success = $this->so->setDeviceDescription($deviceid, $newdescription) 
>= 0;
     
     if ($success)
     {




reply via email to

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