[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.29
From: |
nomail |
Subject: |
[Phpgroupware-cvs] sync/inc/class.ui_sync.inc.php, 1.29 |
Date: |
Thu, 1 Jul 2004 10:46:44 +0200 |
Update of /sync/inc
Modified Files:
Branch:
class.ui_sync.inc.php
date: 2004/07/01 08:46:44; author: mleonhardt; state: Exp; lines: +214 -23
Log Message:
- handful new functions for conflict-view in UI
=====================================================================
Index: sync/inc/class.ui_sync.inc.php
diff -u sync/inc/class.ui_sync.inc.php:1.28 sync/inc/class.ui_sync.inc.php:1.29
--- sync/inc/class.ui_sync.inc.php:1.28 Sun Jun 27 13:56:03 2004
+++ sync/inc/class.ui_sync.inc.php Thu Jul 1 08:46:44 2004
@@ -51,6 +51,7 @@
'testcase' => True,
'cleartables' => True,
'listdevices' => True,
+ 'listconflicts' => True,
'adminlistdevices' => True,
'adminlistsources' => True,
'init' => True,
@@ -62,7 +63,8 @@
'devicesettings' => True,
'savedevicesettings' => True,
'savesourcesettings' => True,
- 'deletesource' => True
+ 'deletesource' => True,
+ 'saveconflictsolution' => True
);
/**
@@ -139,6 +141,7 @@
$this->template->set_block('sync_template','table_header','table_header');
$this->template->set_block('sync_template','lastsync_device','lastsync_device');
$this->template->set_block('sync_template','lastsync_list','lastsync_list');
+
$this->template->set_block('sync_template','lastsync_conflictedit','lastsync_conflictedit');
$this->template->set_block('sync_template','table_footer','table_footer');
$this->template->set_block('sync_template','page_footer','page_footer');
@@ -183,6 +186,7 @@
$this->template->set_var('head_source', lang('head_source'));
$this->template->set_var('head_lastsync', lang('head_lastsync'));
$this->template->set_var('head_fullsync', lang('head_fullsync'));
+ $this->template->set_var('head_conflicts',
lang('head_conflicts'));
$lastsynctable = $this->template->fp('sync_template','table_header');
// all devices of user $phpgw_userlid
@@ -224,6 +228,13 @@
$GLOBALS['phpgw_info']['user']['apps'][$appname]["title"]);
$this->template->set_var('lastsync_fullsync',
lang('lastsync_fullsync'));
$lastsynctable .=
$this->template->fp('sync_template','lastsync_list');
+
+ $this->template->set_var('lastsync_editconflicts',
lang('head_conflicts'));
+ $this->template->set_var('showconflictsformaction',
+
$GLOBALS['phpgw']->link('/index.php','menuaction=sync.ui_sync.listconflicts'));
+
+ if ($this->so->hasconflicts($deviceid,
$source))
+ $lastsynctable .=
$this->template->fp('sync_template','lastsync_conflictedit');
}
}
@@ -299,18 +310,24 @@
}
/**
- * insert a link to the devicelist site of the sync module ui
+ * insert a link to the devicelist site etc. of the sync module ui
*
* @access private
*/
function insert_navigation()
{
+ $ConflictListLink =
$GLOBALS['phpgw']->link('/index.php','menuaction=sync.ui_sync.listconflicts');
$DeviceListLink =
$GLOBALS['phpgw']->link('/index.php','menuaction=sync.ui_sync.listdevices');
+ $SourceListLink =
$GLOBALS['phpgw']->link('/index.php','menuaction=sync.ui_sync.adminlistsources');
$PreferencesLink =
$GLOBALS['phpgw']->link('/index.php','menuaction=sync.ui_sync.preferences');
$this->template->set_block('sync_template','navigation','navigation');
+ $this->template->set_var('ConflictListLink',$ConflictListLink);
$this->template->set_var('DeviceListLink',$DeviceListLink);
+ $this->template->set_var('SourceListLink',$SourceListLink);
+ $this->template->set_var('link_showconflictlist',
lang('link_showconflictlist'));
$this->template->set_var('link_showdevicelist',
lang('link_showdevicelist'));
+ $this->template->set_var('link_showsourcelist',
lang('link_showsourcelist'));
$this->template->set_var('PreferencesLink',$PreferencesLink);
$this->template->set_var('link_preferences', lang('link_preferences'));
@@ -565,57 +582,56 @@
}
/**
- * list all registered sources and the assigned applications
+ * list conflicts
*
* this public function
- * loads the listsources.tpl Template
- * and lists all registered sources of the sync module and the
- * assigned phpGroupware applications
+ * loads the listconflicts.tpl Template
+ * and lists all appeared conflicts of the actual logged in user
* @access public
*/
- function adminlistsources()
+ function listconflicts()
{
- // prevent unauthorized usage
- if (! $this->isadmin) return false;
-
$GLOBALS['phpgw']->common->phpgw_header();
echo parse_navbar();
$this->template =
CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir('sync'));
$this->template->set_file(
Array(
- 'sync_template' => 'listsources.tpl'
+ 'sync_template' => 'listconflicts.tpl'
)
);
+ // get submitted variables
+ $deviceid = get_var('deviceid');
+ $source = get_var('source');
+
// prepare blocks
$this->template->set_block('sync_template','page_header','page_header');
$this->template->set_block('sync_template','table_header','table_header');
$this->template->set_block('sync_template','status','status');
- $this->template->set_block('sync_template','source_list','source_list');
- $this->template->set_block('sync_template','source_new','source_new');
+
$this->template->set_block('sync_template','conflict_header','conflict_header');
+
$this->template->set_block('sync_template','conflict_field','conflict_field');
+
$this->template->set_block('sync_template','conflict_footer','conflict_footer');
$this->template->set_block('sync_template','table_footer','table_footer');
$this->template->set_block('sync_template','page_footer','page_footer');
- // parse
- if ($this->isadmin)
- $IndexLink =
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index');
- else
- $IndexLink =
$GLOBALS['phpgw']->link('/index.php','menuaction=sync.ui_sync.init');
+ $IndexLink =
$GLOBALS['phpgw']->link('/index.php','menuaction=sync.ui_sync.init');
$this->template->set_var('GoBackLink',$IndexLink);
$this->template->set_var('link_back', lang('link_back'));
// parse header
$this->template->set_var('sync', lang('sync'));
- $this->template->set_var('head_sourcelist', lang('head_sourcelist'));
+ $appname = $this->so->GetSourceModule($source);
+ $this->template->set_var('head_conflictlist',
+ sprintf(lang('head_conflictlist'),
$GLOBALS['phpgw_info']['user']['apps'][$appname]["title"]));
$body = $this->template->fp('sync_template','page_header');
// parse status
$this->template->set_var('last_operation_status',
$this->last_operation_status);
$body .= $this->template->fp('sync_template','status');
- // insert sourcelist and parse
- $body .= $this->insert_sourcelist();
+ // insert conflictlist and parse
+ $body .= $this->insert_conflictlist($deviceid, $source);
// parse footer
$body .= $this->template->fp('sync_template','page_footer');
@@ -625,6 +641,146 @@
$GLOBALS['phpgw']->common->phpgw_footer();
}
+
+ /**
+ * insert the list of all appeared conflicts of actual user
+ *
+ * @access private
+ */
+
+ function insert_conflictlist($deviceid, $source)
+ {
+ // get actual user ID
+ $phpgw_userid = $GLOBALS['phpgw_info']['user']['account_id'];
+ $tr_color = '';
+
+ // table header
+ $this->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
+ // account, uri, description, username, edit, delete
+ $this->template->set_var('head_fieldname', lang('head_fieldname'));
+ $this->template->set_var('head_fieldserver', lang('head_fieldserver'));
+ $this->template->set_var('head_fieldclient', lang('head_fieldclient'));
+ $this->template->set_var('head_fieldresult', lang('head_fieldresult'));
+ $this->template->set_var('askfordelete', sprintf('"' .
lang('askfordelete') . '"', '"+s+"'));
+
+ $conflictlisttable = $this->template->fp('sync_template','table_header');
+
+ // all conflicts of user $phpgw_userlid
+ $conflictlist = array();
+ if ($this->so->GetConflictList($deviceid, $source, $conflictlist)) {
+ foreach($conflictlist as $conflict) {
+ $conflictid = $conflict[0];
+ $conflictfields = $this->bo->getConflictArray($deviceid, $source,
$conflict[2], $conflict[3]);
+
+ // conflictheader
+ $this->template->set_var('head_conflict',
+ sprintf(lang('head_conflict'), $conflictid));
+ $conflictlisttable .=
$this->template->fp('sync_template','conflict_header');
+
+ // conflictbody (fields)
+ foreach($conflictfields as $conflictfield)
+ {
+ if (($conflictfield["displayValue"] ==
'') and
+ ($conflictfield["displayValue2"] ==
'')) continue;
+ $isequal =
($conflictfield["displayValue"] == $conflictfield["displayValue2"]);
+
+ // set styles
+ $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
+ $this->template->set_var('tr_color', $tr_color);
+ if ($isequal)
+ $this->template->set_var('conflict_class',
'conflictequal');
+ else
+ $this->template->set_var('conflict_class',
'conflictunequal');
+
+ // set fieldvalues
+ $this->template->set_var('conflict_fieldname',
$conflictfield["displayName"]);
+ $this->template->set_var('conflict_fieldserver',
$conflictfield["displayValue"]);
+ $this->template->set_var('conflict_fieldclient',
$conflictfield["displayValue2"]);
+ $conflictlisttable .=
$this->template->fp('sync_template','conflict_field');
+ }
+
+ // conflictfooter (controls)
+ $this->template->set_var('conflictformaction',
+
$GLOBALS['phpgw']->link('/index.php','menuaction=sync.ui_sync.saveconflictsolution'));
+ $this->template->set_var('conflictid',
$conflictid);
+ $this->template->set_var('link_apply',
lang('link_apply'));
+ $conflictlisttable .=
$this->template->fp('sync_template','conflict_footer');
+ }
+ }
+
+ // table footer
+ $conflictlisttable .= $this->template->fp('sync_template','table_footer');
+
+ return $conflictlisttable;
+ }
+
+ /**
+ * list all registered sources and the assigned applications
+ *
+ * this public function
+ * loads the listsources.tpl Template
+ * and lists all registered sources of the sync module and the
+ * assigned phpGroupware applications
+ * @access public
+ */
+
+ function adminlistsources()
+ {
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
+
+ $this->template =
CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir('sync'));
+ $this->template->set_file(
+ Array(
+ 'sync_template' => 'listsources.tpl'
+ )
+ );
+
+ // prepare blocks
+ $this->template->set_block('sync_template','page_header','page_header');
+ $this->template->set_block('sync_template','table_header','table_header');
+ $this->template->set_block('sync_template','status','status');
+ $this->template->set_block('sync_template','source_list','source_list');
+ $this->template->set_block('sync_template','source_new','source_new');
+ $this->template->set_block('sync_template','table_footer','table_footer');
+ $this->template->set_block('sync_template','page_footer','page_footer');
+
+ // parse
+ if ($this->isadmin)
+ $IndexLink =
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index');
+ else
+ $IndexLink =
$GLOBALS['phpgw']->link('/index.php','menuaction=sync.ui_sync.init');
+ $this->template->set_var('GoBackLink',$IndexLink);
+ $this->template->set_var('link_back', lang('link_back'));
+
+ // prevent unauthorized usage
+ if ($this->isadmin)
+ {
+ // parse header
+ $this->template->set_var('sync', lang('sync'));
+ $this->template->set_var('head_sourcelist',
lang('head_sourcelist'));
+ $body = $this->template->fp('sync_template','page_header');
+
+ // parse status
+ $this->template->set_var('last_operation_status',
$this->last_operation_status);
+ $body .= $this->template->fp('sync_template','status');
+
+ // insert sourcelist and parse
+ $body .= $this->insert_sourcelist();
+
+ // parse footer
+ $body .= $this->template->fp('sync_template','page_footer');
+ // $body .= $devicelist;
+
+ echo $body;
+ }
+ else
+ {
+ echo lang('status_admindisabled');
+ }
+
+ $GLOBALS['phpgw']->common->phpgw_footer();
+ }
/**
* insert the list of all registered sources of the sync module
@@ -730,7 +886,7 @@
error_log("savesourcesettings with sourceid=$sourceid uri=$sourceuri
appmodule=$appmodule");
if ($sourceid == 'new')
- $setresult = $this->so->AddSyncSource($sourceuri, $appmodule, '', '',
$modulename) >= 0;
+ $setresult = $this->so->AddSyncSource($sourceuri, $appmodule, '', '',
$appmodule) >= 0;
else
$setresult = $this->so->SetSourceSettings($sourceid, $sourceuri,
$appmodule) >= 0;
if ($setresult)
@@ -1123,6 +1279,41 @@
$this->listdevices();
}
+ /**
+ * save conflictsolution as chosen in conflictlist by the user
+ *
+ * this public function
+ * loads the listconflicts.tpl or sync.tpl (depending whether a conflict
+ * is available yet
+ * and saves the chosen entry
+ * @access public
+ */
+
+ function saveconflictsolution()
+ {
+ // get submitted variables
+ $conflictid = get_var('conflictid');
+ $action = get_var('conflictaction');
+ $deviceid = get_var('deviceid');
+ $source = get_var('source');
+
+ // set the Settings
+ if ($this->so->SetDeviceSettings($deviceid, $username, $password) >= 0)
+ {
+ $status1 = lang('status_ok');
+ $status2 = '';
+ }
+ else
+ {
+ $status1 = lang('status_error');
+ $status2 = lang('status_not');
+ }
+ $this->last_operation_status = sprintf(lang('status_devicesettingssaved'),
+ $status1, $this->bo->getDeviceName($deviceid), $status2);
+ // show devicelist
+ $this->listdevices();
+ }
+
/**
* Convert a timestamp from full Iso 8601 to php-timestamp
*
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] sync/inc/class.ui_sync.inc.php, 1.29,
nomail <=