[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.12
From: |
nomail |
Subject: |
[Phpgroupware-cvs] sync/inc/class.ui_sync.inc.php, 1.12 |
Date: |
Sun, 23 May 2004 09:44:41 -0000 |
Update of /sync/inc
Modified Files:
Branch:
class.ui_sync.inc.php
date: 2004/04/29 12:17:52; author: mleonhardt; state: Exp; lines: +171 -9
Log Message:
- hooks for sync preferences and admin
- extended ui with:
- user can delete their syncdevices
- user can set the conflicthandling for each source in preferences
=====================================================================
Index: sync/inc/class.ui_sync.inc.php
diff -u sync/inc/class.ui_sync.inc.php:1.11 sync/inc/class.ui_sync.inc.php:1.12
--- sync/inc/class.ui_sync.inc.php:1.11 Mon Apr 26 15:45:57 2004
+++ sync/inc/class.ui_sync.inc.php Thu Apr 29 12:17:52 2004
@@ -34,17 +34,25 @@
'cleartables' => True,
'listdevices' => True,
'init' => True,
- 'deletedevice' => True
+ 'deletedevice' => True,
+ 'preferences' => True,
+ 'saveconflicthandling' => True
);
/**
- * @var string this string contains the statusstring of the last
- * executed operation (i.e. device created/deleted etc.
+ * @var string this string contains the status of the last
+ * executed operation (i.e. device created/deleted etc.)
* @access public
*/
var $last_operation_status = '';
/**
+ * @var Object phpgw object for handling template colors
+ * @access private
+ */
+ var $nextmatchs;
+
+ /**
* @var boolean $debug enable debug-infos
* @access public
*/
@@ -59,11 +67,13 @@
function ui_sync()
{
$this->so = CreateObject('sync.so_sync');
+ $this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
}
/**
* Show applications user interface.
*
+ * this public function
* loads the sync.tpl Template and shows the default init site of the sync
module
* @access public
*/
@@ -148,7 +158,8 @@
/**
* clear some tables of phpGW
*
- * this function calls the Testcase-routine from testcase.inc.php and
+ * this public function
+ * calls the Testcase-routine from testcase.inc.php and
* displays the unfiltered output
*
* @access public
@@ -187,7 +198,8 @@
/**
* call and output testcase
*
- * this function calls the Testcase-routine from testcase.inc.php and
+ * this public function
+ * calls the Testcase-routine from testcase.inc.php and
* displays the unfiltered output
*
* @access public
@@ -218,6 +230,7 @@
//TODO: lang-support:
// 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_account', lang('head_account'));
$this->template->set_var('head_uri', lang('head_uri'));
@@ -231,6 +244,8 @@
$devicelist = array();
if ($this->so->GetDeviceList($phpgw_userid, $devicelist)) {
foreach($devicelist as $device) {
+ $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[0]));
$this->template->set_var('device_uri', $device[1]);
$this->template->set_var('device_description', $device[2]);
@@ -253,7 +268,7 @@
/**
* list registered devices
*
- * this function
+ * this public function
* loads the sync.tpl Template and shows the default init site of the sync
module
* and lists all registered devices of the actual logged in user
* @access public
@@ -271,13 +286,15 @@
)
);
+ // 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','device_status','device_status');
+ $this->template->set_block('sync_template','status','status');
$this->template->set_block('sync_template','device_list','device_list');
$this->template->set_block('sync_template','table_footer','table_footer');
$this->template->set_block('sync_template','page_footer','page_footer');
+ // parse
$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'));
@@ -286,7 +303,7 @@
// parse status
$this->template->set_var('last_operation_status',
$this->last_operation_status);
- $body .= $this->template->fp('sync_template','device_status');
+ $body .= $this->template->fp('sync_template','status');
// insert devicelist and parse
$body .= $this->insert_devicelist();
@@ -323,8 +340,153 @@
$status1 = lang('status_error');
$status2 = lang('status_not');
}
- $this->last_operation_status = sprintf(lang('status_del_deldevice'),
$status1, $status2, $del_device_id);
+ $this->last_operation_status = sprintf(lang('status_deldevice'), $status1,
$status2, $del_device_id);
$this->listdevices();
+ }
+
+ /**
+ * show syncmodul preferences
+ *
+ * this public function
+ * loads the preferences.tpl Template and shows the conflict-handling
settings of the user
+ * @access public
+ */
+
+ function preferences()
+ {
+ $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' => 'preferences.tpl'
+ )
+ );
+
+ // prepare blocks
+ $this->template->set_block('sync_template','page_header','page_header');
+ $this->template->set_block('sync_template','status','status');
+
$this->template->set_block('sync_template','conflicthandling','conflicthandling');
+ $this->template->set_block('sync_template','table_header','table_header');
+
$this->template->set_block('sync_template','conflicthandling_list','conflicthandling_list');
+ $this->template->set_block('sync_template','table_footer','table_footer');
+ $this->template->set_block('sync_template','page_footer','page_footer');
+
+ // parse
+ $this->template->set_var('preferences', lang('sync_preferences'));
+ $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');
+
+ $body .= $this->insert_conflicthandling();
+ $body .= $this->template->fp('sync_template','page_footer');
+
+ echo $body;
+
+ $GLOBALS['phpgw']->common->phpgw_footer();
+ }
+
+ /**
+ * insert the html-content for setting up users conflicthandling
+ *
+ * @access private
+ */
+
+ function insert_conflicthandling()
+ {
+ //prepare variables
+ $this->template->set_var('conflicthandling', lang('conflicthandling'));
+ //table header
+ $this->template->set_var('conflicthandlingformaction',
+
$GLOBALS['phpgw']->link('/index.php',"menuaction=sync.ui_sync.saveconflicthandling"));
+ $this->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
+ $this->template->set_var('head_source', lang('head_source'));
+ $this->template->set_var('head_conflicthandling',
lang('head_conflicthandling'));
+ $this->template->set_var('save', lang('save'));
+ $this->template->set_var('reset', lang('reset'));
+
+ //parse
+ $conflicthandlingtable =
$this->template->fp('sync_template','conflicthandling');
+ $conflicthandlingtable .=
$this->template->fp('sync_template','table_header');
+ $conflicthandlingtable .= $this->insert_conflicthandling_list();
+ $conflicthandlingtable .=
$this->template->fp('sync_template','table_footer');
+ return $conflicthandlingtable;
+ }
+
+ /**
+ * return the conflicthandling list as htmltable string
+ *
+ * @access private
+ */
+
+ function insert_conflicthandling_list()
+ {
+ //getallsyncsources()
+ $sources = array('Addressbuch', 'Notes', 'Kalender');
+ //get-/setconflicthandlingsettings(source, handlingtype)
+ $conflictsolutions = array(serverwins, clientwins, duplicate, donothing);
+
+ $conflicthandlinglist = '';
+ 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
+ $selectoptions = '';
+ foreach ($conflictsolutions as $solution)
+ {
+ $selectedstring = $solution==$selected?' selected':'';
+ $listtext = lang("conflict_$solution");
+ $selectoptions .= "<option $selectedstring
value=\"$solution\">$listtext</option>";
+ }
+ $this->template->set_var('conflicthandlingtype', $selectoptions);
+ $conflicthandlinglist .=
$this->template->fp('sync_template','conflicthandling_list');
+ }
+ return $conflicthandlinglist;
+ }
+
+ /**
+ * save conflicthandling as set by the user in the preferences dialog
+ *
+ * this public function
+ * loads the preferences.tpl Template and shows the conflict-handling
settings of the user
+ * and lists the changed preferences
+ * @access public
+ */
+
+ function saveconflicthandling()
+ {
+ //getallsyncsources()
+ $sources = array('Addressbuch', 'Notes', 'Kalender');
+ //get-/setconflicthandlingsettings(source, handlingtype)
+ $conflictsolutions = array(serverwins, clientwins, duplicate, donothing);
+
+ $success = 0;
+ foreach($sources as $source) {
+ $handlingtype = get_var("conflict_$source");
+ if ($handlingtype != '')
+ {
+//TODO!! if (setconflicthandlingsettings(source, handlingtype) >= 1)
$success++;
+ $success++;
+ }
+ }
+
+ if ($success == count($sources))
+ {
+ $status1 = lang('status_ok');
+ $status2 = '';
+ }
+ else
+ {
+ $status1 = lang('status_error');
+ $status2 = lang('status_not');
+ }
+ $this->last_operation_status = sprintf(lang('status_prefsaved'), $status1,
$status2);
+ $this->preferences();
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] sync/inc/class.ui_sync.inc.php, 1.12,
nomail <=