calling /folder/ with an id will return the root folder

This commit is contained in:
Uwe Steinmann 2017-12-20 13:18:07 +01:00
parent 80c5934eb1
commit 1a9f6895f7

View File

@ -182,10 +182,13 @@ function getLockedDocuments() { /* {{{ */
} }
} /* }}} */ } /* }}} */
function getFolder($id) { /* {{{ */ function getFolder($id = null) { /* {{{ */
global $app, $dms, $userobj; global $app, $dms, $userobj, $settings;
$forcebyname = $app->request()->get('forcebyname'); $forcebyname = $app->request()->get('forcebyname');
if(is_numeric($id) && empty($forcebyname))
if ($id === null)
$folder = $dms->getFolder($settings->_rootFolderID);
else if(is_numeric($id) && empty($forcebyname))
$folder = $dms->getFolder($id); $folder = $dms->getFolder($id);
else { else {
$parentid = $app->request()->get('parentid'); $parentid = $app->request()->get('parentid');
@ -1414,6 +1417,7 @@ $app->get('/logout', 'doLogout');
$app->get('/account', 'getAccount'); $app->get('/account', 'getAccount');
$app->get('/search', 'doSearch'); $app->get('/search', 'doSearch');
$app->get('/searchbyattr', 'doSearchByAttr'); $app->get('/searchbyattr', 'doSearchByAttr');
$app->get('/folder/', 'getFolder');
$app->get('/folder/:id', 'getFolder'); $app->get('/folder/:id', 'getFolder');
$app->post('/folder/:id/move', 'moveFolder'); $app->post('/folder/:id/move', 'moveFolder');
$app->delete('/folder/:id', 'deleteFolder'); $app->delete('/folder/:id', 'deleteFolder');