[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] sync/inc/class.ui_sync.inc.php, 1.16
From: |
nomail |
Subject: |
[Phpgroupware-cvs] sync/inc/class.ui_sync.inc.php, 1.16 |
Date: |
Sun, 23 May 2004 15:30:20 -0000 |
Update of /sync/inc
Modified Files:
Branch:
class.ui_sync.inc.php
date: 2004/05/03 08:14:11; author: mleonhardt; state: Exp; lines: +60 -23
Log Message:
- conflicthandling settings saving now works
=====================================================================
Index: sync/inc/class.ui_sync.inc.php
diff -u sync/inc/class.ui_sync.inc.php:1.15 sync/inc/class.ui_sync.inc.php:1.16
--- sync/inc/class.ui_sync.inc.php:1.15 Sat May 1 10:15:38 2004
+++ sync/inc/class.ui_sync.inc.php Mon May 3 08:14:11 2004
@@ -60,11 +60,25 @@
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
*/
var $debug = true;
+
/**
* Constructor
*
@@ -361,7 +375,6 @@
{
// get actual user ID
$phpgw_userid = $GLOBALS['phpgw_info']['user']['account_id'];
- //TODO: lang-support:
// table header
$this->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
@@ -518,10 +531,6 @@
{
// get actual user ID
$phpgw_userid = $GLOBALS['phpgw_info']['user']['account_id'];
- //getallsyncsources()
- $sources = array('Addressbuch', 'Notes', 'Kalender');
- //get-/setconflicthandlingsettings(source, handlingtype)
- $conflictsolutions = array(serverwins, clientwins, duplicate, donothing);
// all devices of user $phpgw_userlid
$devicelist = array();
@@ -529,18 +538,26 @@
// device
foreach($devicelist as $device) {
+ $deviceid = $device[0];
$this->template->set_var('conflicthandling_devicelabel',
lang('sync_devicelabel'));
- $this->template->set_var('conflicthandling_devicename',
$this->bo->getDeviceName($device[0]));
+ $this->template->set_var('conflicthandling_devicename',
$this->bo->getDeviceName($deviceid));
$conflicthandlinglist .=
$this->template->fp('sync_template','conflicthandling_device');
+
+ $sources = $this->so->getUsedSources($deviceid);
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('source', $source);
- $this->template->set_var('sourceidentifier', "conflict_$source");
- $selected = $conflictsolutions[rand(0, 3)]; //!!TODO
+ $this->template->set_var('source',
$this->so->GetSourceModule($source));
+ $this->template->set_var('sourceidentifier',
"conflict_$deviceid_$source");
+ $selectedid = $this->so->GetConflictHandleSetting($deviceid,
$source);
+ // in case of readerror we use the default (3 = duplicate)
+ if ($selectedid < 0) $selectedid = 3;
+ // convert to
+ $selected = $this->conflictsolutions[$selectedid];
$selectoptions = '';
- foreach ($conflictsolutions as $solution)
+ reset($this->conflictsolutions);
+ foreach ($this->conflictsolutions as $solution)
{
$selectedstring = $solution==$selected?' selected':'';
$listtext = lang("conflict_$solution");
@@ -555,7 +572,7 @@
}
/**
- * save conflicthandling as set by the user in the preferences dialog
+ * save conflicthandling as set by the user in the preferences
(conflicthandling list) dialog
*
* this public function
* loads the preferences.tpl Template and shows the conflict-handling
settings of the user
@@ -565,22 +582,42 @@
function saveconflicthandling()
{
- //getallsyncsources()
- $sources = array('Addressbuch', 'Notes', 'Kalender');
- //get-/setconflicthandlingsettings(source, handlingtype)
- $conflictsolutions = array(serverwins, clientwins, duplicate, donothing);
-
+ // get actual user ID
+ $phpgw_userid = $GLOBALS['phpgw_info']['user']['account_id'];
+
+ // all devices of user $phpgw_userlid
+ $devicelist = array();
$success = 0;
- foreach($sources as $source) {
- $handlingtype = get_var("conflict_$source");
- if ($handlingtype != '')
- {
-//TODO!! if (setconflicthandlingsettings(source, handlingtype) >= 1)
$success++;
- $success++;
+ $sourcecount = 0;
+
+ if ($this->so->GetDeviceList($phpgw_userid, $devicelist)) {
+
+ // device
+ foreach($devicelist as $device) {
+ $deviceid = $device[0];
+ $sources = $this->so->getUsedSources($deviceid);
+
+ foreach($sources as $source) {
+ $sourcecount++;
+ $handlingtype = get_var("conflict_$deviceid_$source");
+ if ($this->debug)
+ error_log("conflict[$deviceid]_$source has type: $handlingtype");
+ if ($handlingtype != '')
+ {
+ reset($this->conflictsolutions);
+ while (list($solutionkey, $solution) =
each($this->conflictsolutions)) {
+ if ($solution == $handlingtype)
+ {
+ if ($this->so->SetConflictHandleSetting($deviceid, $source,
$solutionkey) >= 1)
+ $success++;
+ }
+ }
+ }
+ }
}
}
- if ($success == count($sources))
+ if ($success == $sourcecount)
{
$status1 = lang('status_ok');
$status2 = '';
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] sync/inc/class.ui_sync.inc.php, 1.16,
nomail <=