Commit 0e103dae authored by Manfred Kutas's avatar Manfred Kutas

ZP-902 List folder types and readonly flag in

ZPushAdmin->AdditionalFolderList().

Released under the Affero GNU General Public License (AGPL) version 3.
parent 25b1ee3b
......@@ -1085,6 +1085,30 @@ class Utils {
'ArmSCII8',
);
}
/**
* Returns folder origin from its id.
*
* @param string $fid
*
* @access public
* @return string
*/
public static function GetFolderOriginFromId($fid) {
$origin = substr($fid, 0, 1);
switch ($origin) {
case DeviceManager::FLD_ORIGIN_CONFIG:
return 'configured';
case DeviceManager::FLD_ORIGIN_GAB:
return 'GAB';
case DeviceManager::FLD_ORIGIN_SHARED:
return 'shared';
case DeviceManager::FLD_ORIGIN_USER:
return 'user';
}
ZLog::Write(LOGLEVEL_WARN, sprintf("Utils->GetFolderOriginFromId(): Unknown folder origin for folder with id '%s'", $fid));
return 'unknown';
}
}
......
......@@ -485,21 +485,23 @@ class ZPushAdmin {
// unify the lists saved for the user/device and the staticly configured one
$new_list = array();
foreach ($device->GetAdditionalFolders() as $folder) {
$folder['source'] = 'user';
$folder['syncfolderid'] = $device->GetFolderIdForBackendId($folder['folderid'], false, false, null);
$syncfolderid = $device->GetFolderIdForBackendId($folder['folderid'], false, false, null);
$folder['syncfolderid'] = $syncfolderid;
$folder['origin'] = Utils::GetFolderOriginFromId($syncfolderid);
$new_list[$folder['folderid']] = $folder;
}
foreach (ZPush::GetAdditionalSyncFolders() as $fid => $so) {
// if this is not part of the device list
if (!isset($new_list[$fid])) {
$syncfolderid = $device->GetFolderIdForBackendId($fid, false, false, null);
$new_list[$fid] = array(
'store' => $so->Store,
'folderid' => $fid,
'syncfolderid' => $device->GetFolderIdForBackendId($fid, false, false, null),
'syncfolderid' => $syncfolderid,
'name' => $so->displayname,
'type' => $so->type,
'readonly' => $so->ReadOnly,
'source' => 'static'
'origin' => Utils::GetFolderOriginFromId($syncfolderid),
);
}
}
......
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