[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.27
From: |
nomail |
Subject: |
[Phpgroupware-cvs] sync/inc/class.ui_sync.inc.php, 1.27 |
Date: |
Thu, 17 Jun 2004 18:00:26 +0200 |
Update of /sync/inc
Modified Files:
Branch:
class.ui_sync.inc.php
date: 2004/06/17 16:00:26; author: mleonhardt; state: Exp; lines: +108 -10
Log Message:
- completed sourcelist editor
- now using official get admin acl for admin-functionality
- changed mimetype handling
=====================================================================
Index: sync/inc/class.ui_sync.inc.php
diff -u sync/inc/class.ui_sync.inc.php:1.26 sync/inc/class.ui_sync.inc.php:1.27
--- sync/inc/class.ui_sync.inc.php:1.26 Sun Jun 6 15:45:18 2004
+++ sync/inc/class.ui_sync.inc.php Thu Jun 17 16:00:26 2004
@@ -48,7 +48,9 @@
'savedevicedescription' => True,
'resetchannel' => True,
'devicesettings' => True,
- 'savedevicesettings' => True
+ 'savedevicesettings' => True,
+ 'savesourcesettings' => True,
+ 'deletesource' => True
);
/**
@@ -96,6 +98,7 @@
$this->bo = CreateObject('sync.bo_sync');
$this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
$this->datetime = CreateObject('phpgwapi.datetime');
+ $this->isadmin = $GLOBALS['phpgw']->acl->check('run',1,'admin');
}
/**
@@ -330,6 +333,7 @@
// sync
$GLOBALS['phpgw']->db->query("TRUNCATE TABLE
phpgw_syncmapping;",__LINE__,__FILE__);
$GLOBALS['phpgw']->db->query("TRUNCATE TABLE
phpgw_syncchannels;",__LINE__,__FILE__);
+ $GLOBALS['phpgw']->db->query("TRUNCATE TABLE
phpgw_syncconflicts;",__LINE__,__FILE__);
// todo
$GLOBALS['phpgw']->db->query("TRUNCATE TABLE
phpgw_todo;",__LINE__,__FILE__);
@@ -434,7 +438,6 @@
function adminlistdevices()
{
- $this->isadmin = true;
$this->listdevices();
}
@@ -484,8 +487,8 @@
$this->template->set_var('device_edit', lang('head_edit'));
$this->template->set_var('devicesettingformaction',
$GLOBALS['phpgw']->link('/index.php',"menuaction=sync.ui_sync.devicesettings"));
- $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('DeviceDeleteLink',
+
$GLOBALS['phpgw']->link('/index.php','menuaction=sync.ui_sync.deletedevice&del_device_id='
. $deviceid));
$this->template->set_var('device_delete', lang('delete'));
$devicelisttable .= $this->template->fp('sync_template','device_list');
}
@@ -538,8 +541,9 @@
function adminlistsources()
{
- $this->isadmin = true;
-
+ // prevent unauthorized usage
+ if (! $this->isadmin) return false;
+
$GLOBALS['phpgw']->common->phpgw_header();
echo parse_navbar();
@@ -555,6 +559,7 @@
$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');
@@ -631,23 +636,115 @@
$this->template->set_var('appmodule', $selectoptions);
$this->template->set_var('sourcesettingformaction',
-
$GLOBALS['phpgw']->link('/index.php',"menuaction=sync.ui_sync.savesource"));
+
$GLOBALS['phpgw']->link('/index.php',"menuaction=sync.ui_sync.savesourcesettings"));
$this->template->set_var('sourceid', $sourceid);
$this->template->set_var('save', lang('save'));
$this->template->set_var('sourcedeleteformaction',
$GLOBALS['phpgw']->link('/index.php',"menuaction=sync.ui_sync.sourcesettings"));
- $DeviceDeleteLink =
$GLOBALS['phpgw']->link('/index.php','menuaction=sync.ui_sync.deletesource&del_source_id='
. $sourceid);
- $this->template->set_var('DeviceSourceLink',$SourceDeleteLink);
+ $this->template->set_var('SourceDeleteLink',
+ $GLOBALS['phpgw']->link('/index.php',
+
'menuaction=sync.ui_sync.deletesource&del_source_id=' . $sourceid .
+ '&del_source_uri='. $source["uri"]));
$this->template->set_var('source_delete', lang('delete'));
$sourcelisttable .= $this->template->fp('sync_template','source_list');
}
+ // new entry
+ $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
+ $this->template->set_var('tr_color', $tr_color);
+ $this->template->set_var('sourcesettingformaction',
+
$GLOBALS['phpgw']->link('/index.php',"menuaction=sync.ui_sync.savesourcesettings"));
+
+ $selectoptions = '';
+ reset($GLOBALS['phpgw_info']['user']['apps']);
+ foreach ($GLOBALS['phpgw_info']['user']['apps'] as $module)
+ {
+ $moduletitle = $module['title'];
+ $modulename = $module['name'];
+ $selectoptions .= "<option value=\"$modulename\">$moduletitle</option>";
+ }
+ $this->template->set_var('appmodule', $selectoptions);
+ $this->template->set_var('source_createnew', lang('head_new'));
+
+ $sourcelisttable .= $this->template->fp('sync_template','source_new');
+
// table footer
$sourcelisttable .= $this->template->fp('sync_template','table_footer');
+
return $sourcelisttable;
}
/**
+ * save source settings
+ *
+ * this public function
+ * loads the listsources.tpl
+ * and saves the new settings
+ * @access public
+ */
+
+ function savesourcesettings()
+ {
+ // get submitted variables
+ $sourceid = get_var('sourceid');
+ $sourceuri = get_var('source_uri_text'.$sourceid);
+ $appmodule = get_var('appselect'.$sourceid);
+
+ // set the Settings
+ if ($this->debug)
+ error_log("savesourcesettings with sourceid=$sourceid uri=$sourceuri
appmodule=$appmodule");
+
+ if ($sourceid == 'new')
+ $setresult = $this->so->AddSyncSource($sourceuri, $appmodule, '', '',
$modulename) >= 0;
+ else
+ $setresult = $this->so->SetSourceSettings($sourceid, $sourceuri,
$appmodule) >= 0;
+ if ($setresult)
+ {
+ $status1 = lang('status_ok');
+ $status2 = '';
+ }
+ else
+ {
+ $status1 = lang('status_error');
+ $status2 = lang('status_not');
+ }
+ $this->last_operation_status = sprintf(lang('status_prefsaved'),
+ $status1, $sourceuri, $status2);
+ // show sourcelist
+ $this->adminlistsources();
+ }
+
+ /**
+ * delete a source
+ *
+ * this function
+ * loads the sync.tpl Template and shows the default init site of the sync
module
+ * and lists all registered sources of the actual logged in user after
deleting
+ * the requested source given in URL-var 'del_source_id'
+ * @access public
+ */
+
+ function deletesource()
+ {
+ $del_source_id = get_var('del_source_id');
+ $del_source_uri = get_var('del_source_uri');
+
+ if ($this->so->DeleteSource($del_source_id) >= 0)
+ {
+ $status1 = lang('status_ok');
+ $status2 = '';
+ }
+ else
+ {
+ $status1 = lang('status_error');
+ $status2 = lang('status_not');
+ }
+ $this->last_operation_status = sprintf(lang('status_delsource'),
+ $status1, $del_source_uri, $status2);
+ $this->adminlistsources();
+ }
+
+ /**
* show syncmodul preferences
*
* this public function
@@ -990,6 +1087,7 @@
// 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.27,
nomail <=