Commit e588ebf6 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #448 in ZP/z-push from...

Merge pull request #448 in ZP/z-push from feature/ZP-1119-z-push-admin-should-show-info-about to develop

* commit '44f9222b':
  ZP-1119 Remove unnecessary check on KOE_GAB_NAME, fixed spacing.
  ZP-1119 Fixed warnings.
  ZP-1119 Fixed warnings if device has no additional folders.
  ZP-1119 Add dots to store and name if they are too long and need to be shortened.
  ZP-1119 Show information about shared folders in z-push-admin.
parents 74e00147 44f9222b
...@@ -810,8 +810,11 @@ class ASDevice extends StateObject { ...@@ -810,8 +810,11 @@ class ASDevice extends StateObject {
* @return array * @return array
*/ */
public function GetAdditionalFolders() { public function GetAdditionalFolders() {
if (is_array($this->additionalfolders)) {
return array_values($this->additionalfolders); return array_values($this->additionalfolders);
} }
return array();
}
/** /**
* Returns an additional folder by folder ID. * Returns an additional folder by folder ID.
......
...@@ -744,6 +744,7 @@ class ZPushAdminCLI { ...@@ -744,6 +744,7 @@ class ZPushAdminCLI {
* @access private * @access private
*/ */
static private function printDeviceData($deviceId, $user) { static private function printDeviceData($deviceId, $user) {
global $additionalFolders;
$device = ZPushAdmin::GetDeviceDetails($deviceId, $user); $device = ZPushAdmin::GetDeviceDetails($deviceId, $user);
if (! $device instanceof ASDevice) { if (! $device instanceof ASDevice) {
...@@ -765,7 +766,7 @@ class ZPushAdminCLI { ...@@ -765,7 +766,7 @@ class ZPushAdminCLI {
switch($type) { switch($type) {
case SYNC_FOLDER_TYPE_APPOINTMENT: case SYNC_FOLDER_TYPE_APPOINTMENT:
case SYNC_FOLDER_TYPE_USER_APPOINTMENT: case SYNC_FOLDER_TYPE_USER_APPOINTMENT:
if (KOE_GAB_NAME != "" && $name == KOE_GAB_NAME) { if ($name == KOE_GAB_NAME) {
$gentype = "GAB"; $gentype = "GAB";
} }
else { else {
...@@ -809,6 +810,46 @@ class ZPushAdminCLI { ...@@ -809,6 +810,46 @@ class ZPushAdminCLI {
} }
if (!$folderinfo) $folderinfo = "None available"; if (!$folderinfo) $folderinfo = "None available";
// additional folders
$addFolders = array();
$sharedFolders = $device->GetAdditionalFolders();
array_walk($sharedFolders, function (&$key) { $key["origin"] = 'Shared'; });
// $additionalFolders comes directly from the config
array_walk($additionalFolders, function (&$key) { $key["origin"] = 'Configured'; });
foreach(array_merge($additionalFolders,$sharedFolders) as $df) {
$df['additional'] = '';
$syncfolderid = $device->GetFolderIdForBackendId($df['folderid'], false, false, null);
switch($df['type']) {
case SYNC_FOLDER_TYPE_USER_APPOINTMENT:
if ($name == KOE_GAB_NAME) {
$gentype = "GAB";
}
else {
$gentype = "Calendar";
}
break;
case SYNC_FOLDER_TYPE_USER_CONTACT:
$gentype = "Contact";
break;
case SYNC_FOLDER_TYPE_USER_TASK:
$gentype = "Task";
break;
case SYNC_FOLDER_TYPE_USER_NOTE:
$gentype = "Note";
break;
default:
$gentype = "Email";
break;
}
if ($device->GetFolderType($syncfolderid) == SYNC_FOLDER_TYPE_UNKNOWN) {
$df['additional'] = "(KOE patching incomplete)";
}
$df['type'] = $gentype;
$df['synched'] = ($device->GetFolderUUID($syncfolderid)) ? 'Active' : 'Inactive (not yet synchronized or no permissions)';
$addFolders[] = $df;
}
$addFoldersTotal = !empty($addFolders) ? count($addFolders) : 'none';
echo "-----------------------------------------------------\n"; echo "-----------------------------------------------------\n";
echo "DeviceId:\t\t$deviceId\n"; echo "DeviceId:\t\t$deviceId\n";
echo "Device type:\t\t". ($device->GetDeviceType() !== ASDevice::UNDEFINED ? $device->GetDeviceType() : "unknown") ."\n"; echo "Device type:\t\t". ($device->GetDeviceType() !== ASDevice::UNDEFINED ? $device->GetDeviceType() : "unknown") ."\n";
...@@ -860,6 +901,16 @@ class ZPushAdminCLI { ...@@ -860,6 +901,16 @@ class ZPushAdminCLI {
} }
} }
} }
echo "Additional Folders:\t$addFoldersTotal\n";
foreach ($addFolders as $folder) {
if (strlen($folder['store']) > 14) {
$folder['store'] = substr($folder['store'], 0, 12) . "..";
}
if (strlen($folder['name']) > 20) {
$folder['name'] = substr($folder['name'], 0, 18) . "..";
}
printf("\t%s %s %s %s %s %s\n", str_pad($folder['origin'], 10), str_pad($folder['type'], 8), str_pad($folder['store'], 14), str_pad($folder['name'], 20), $folder['synched'], $folder['additional']);
}
echo "Status:\t\t\t"; echo "Status:\t\t\t";
switch ($device->GetWipeStatus()) { switch ($device->GetWipeStatus()) {
case SYNC_PROVISION_RWSTATUS_OK: case SYNC_PROVISION_RWSTATUS_OK:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment