function cmis_browser_actions_form_submit in CMIS API 7
Same name and namespace in other branches
- 6.4 cmis_browser/cmis_browser.module \cmis_browser_actions_form_submit()
- 6.2 cmis_browser/cmis_browser.module \cmis_browser_actions_form_submit()
- 6.3 cmis_browser/cmis_browser.module \cmis_browser_actions_form_submit()
- 7.2 cmis_browser/cmis_browser.module \cmis_browser_actions_form_submit()
Implementation of hook_form_submit().
File
- cmis_browser/
cmis_browser.module, line 242
Code
function cmis_browser_actions_form_submit($form, &$form_state) {
module_load_include('content_create.inc', 'cmis_browser');
$path = rawurlencode('/' . implode('/', array_slice(explode('/', $_GET['q']), 2)));
switch ($form_state['clicked_button']['#name']) {
case 'folder_create_action':
_cmis_browser_actions_folder_create($path, $form_state['values']['folder_name']);
break;
case 'content_create_action':
_cmis_browser_actions_content_create($path, $form_state['values']['content_name'], $form_state['values']['content_body'], 'text/html');
break;
case 'content_upload_action':
// @todo cleanup uploaded file
$file = file_save_upload('file');
if ($file) {
$file_stream = fopen($file->uri, 'r');
_cmis_browser_actions_content_create($path, $file->filename, $file_stream, $file->filemime);
}
else {
form_set_error('content_upload', t('Unable to handle uploaded file.'));
}
break;
}
}