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.26


From: nomail
Subject: [Phpgroupware-cvs] sync/inc/class.ui_sync.inc.php, 1.26
Date: Sun, 6 Jun 2004 17:45:18 +0200

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

date: 2004/06/06 15:45:18;  author: mleonhardt;  state: Exp;  lines: +126 -4

Log Message:
- Sourcelist for Admin
=====================================================================
Index: sync/inc/class.ui_sync.inc.php
diff -u sync/inc/class.ui_sync.inc.php:1.25 sync/inc/class.ui_sync.inc.php:1.26
--- sync/inc/class.ui_sync.inc.php:1.25 Thu Jun  3 18:57:12 2004
+++ sync/inc/class.ui_sync.inc.php      Sun Jun  6 15:45:18 2004
@@ -40,6 +40,7 @@
       'cleartables'   => True,
       'listdevices' => True,
       'adminlistdevices' => True,
+      'adminlistsources' => True,
                        'init'        => True,
       'deletedevice' => True,
       'preferences' => True,
@@ -200,8 +201,8 @@
           }
           $this->template->set_var('lastsync_lastsync', $lastsync);
           $this->template->set_var('deviceid', $deviceid);
+          $this->template->set_var('lastsync_source', $source);
           $appname = $this->so->GetSourceModule($source);
-          $this->template->set_var('lastsync_source', $appname);
           $this->template->set_var('lastsync_source_title',
           // arrays are for everone ;-) 
             $GLOBALS['phpgw_info']['user']['apps'][$appname]["title"]);
@@ -233,7 +234,7 @@
     // get posted variables
     $deviceid = get_var('deviceid');
     $source = get_var('source');
-
+    
     if (($deviceid != '') and ($source != ''))
       $success = $this->so->resetChanneltoFullsync($deviceid, $source) >= 0;
     
@@ -461,10 +462,10 @@
     $this->template->set_var('head_username', lang('head_auth'));
     $this->template->set_var('head_edit', lang('head_edit'));
     $this->template->set_var('head_delete', lang('head_delete'));
-    $devicelisttable = $this->template->fp('sync_template','table_header');
-
     $this->template->set_var('askfordelete', sprintf('"' . 
lang('askfordelete') . '"', '"+s+"'));
     
+    $devicelisttable = $this->template->fp('sync_template','table_header');
+
     // all devices of user $phpgw_userlid
     $devicelist = array();
     if ($this->so->GetDeviceList($phpgw_userid, $devicelist)) {
@@ -523,6 +524,127 @@
     $this->last_operation_status = sprintf(lang('status_deldevice'), 
              $status1, $this->bo->getDeviceName($del_device_id), $status2);
     $this->listdevices();
+  }
+
+  /**
+   * 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()
+  {
+    $this->isadmin = true;
+
+    $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','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'));
+    // 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;
+      
+    $GLOBALS['phpgw']->common->phpgw_footer();
+  }
+  
+  /**
+   * insert the list of all registered sources of the sync module
+   *
+   * @access  private
+   */
+
+  function insert_sourcelist()
+  {
+    $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_uri', lang('head_uri'));
+    $this->template->set_var('head_module', lang('head_module'));
+    $this->template->set_var('head_save', lang('save'));
+    $this->template->set_var('head_delete', lang('head_delete'));
+    $this->template->set_var('askfordelete', sprintf('"' . 
lang('askfordelete') . '"', '"+s+"'));
+    
+    $sourcelisttable = $this->template->fp('sync_template','table_header');
+
+    // all sources in sync module
+    $sourcelist = $this->so->getSupportedSources(true);
+    
+    foreach($sourcelist as $source) {
+      $sourceid = $source["sourceid"];
+      $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
+      $this->template->set_var('tr_color', $tr_color);
+      $this->template->set_var('source_uri', $source["uri"]);
+      
+      $this->template->set_var('sourceidentifier', "$sourceid");
+      $selected = $source["modulename"];
+      // selected module for this source 
+      $selectoptions = '';
+      reset($GLOBALS['phpgw_info']['user']['apps']);
+      foreach ($GLOBALS['phpgw_info']['user']['apps'] as $module)
+      { 
+        $moduletitle = $module['title'];
+        $modulename = $module['name'];
+        $selectedstring = $modulename==$selected?' selected':'';
+        $selectoptions .= "<option $selectedstring 
value=\"$modulename\">$moduletitle</option>";
+      }
+      $this->template->set_var('appmodule', $selectoptions);
+      
+      $this->template->set_var('sourcesettingformaction', 
+        
$GLOBALS['phpgw']->link('/index.php',"menuaction=sync.ui_sync.savesource"));
+      $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('source_delete', lang('delete'));
+      $sourcelisttable .= $this->template->fp('sync_template','source_list');
+    }
+
+    // table footer
+    $sourcelisttable .= $this->template->fp('sync_template','table_footer');
+    return $sourcelisttable;
   }
 
   /**




reply via email to

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