function _cmis_browser_actions_folder_create in CMIS API 6.4
Same name and namespace in other branches
- 6.2 cmis_browser/cmis_browser.content_create.inc \_cmis_browser_actions_folder_create()
- 6.3 cmis_browser/cmis_browser.content_create.inc \_cmis_browser_actions_folder_create()
- 7.2 cmis_browser/cmis_browser.content_create.inc \_cmis_browser_actions_folder_create()
- 7 cmis_browser/cmis_browser.content_create.inc \_cmis_browser_actions_folder_create()
Create $folder_name under $parent_folder
1 call to _cmis_browser_actions_folder_create()
- cmis_browser_actions_form_submit in cmis_browser/
cmis_browser.module - Implementation of hook_form_submit().
File
- cmis_browser/
cmis_browser.content_create.inc, line 7
Code
function _cmis_browser_actions_folder_create($parent_folder_path, $folder_name) {
module_load_include('api.inc', 'cmis');
$repository = cmis_get_repository();
try {
$parent_folder = cmisapi_getObjectByPath($repository->repositoryId, $parent_folder_path);
} catch (CMISException $e) {
cmis_error_handler('_cmis_browser_actions_folder_create', $e);
form_set_error('path', t('Error while trying to lookup @object_id', array(
'@path' => $parent_folder_path,
)));
return '';
}
if ($parent_folder->properties['cmis:baseTypeId'] == 'cmis:folder') {
try {
$folder_id = cmisapi_createFolder($repository->repositoryId, $parent_folder->id, $folder_name);
drupal_set_message(t('CMIS object @name has been created.', array(
'@name' => $folder_name,
)));
} catch (CMISException $e) {
cmis_error_handler('cmis_folder_create_form_submit', $e);
form_set_error('path', t('Unable to create @object_name object.', array(
'@object_name' => $folder_name,
)));
return '';
}
}
else {
form_set_error('path', t('Error while trying to lookup @object_path', array(
'@object_path' => $parent_folder_path,
)));
return FALSE;
}
}