You are here

function cmis_browser_actions_form_submit in CMIS API 7.2

Same name and namespace in other branches
  1. 6.4 cmis_browser/cmis_browser.module \cmis_browser_actions_form_submit()
  2. 6.2 cmis_browser/cmis_browser.module \cmis_browser_actions_form_submit()
  3. 6.3 cmis_browser/cmis_browser.module \cmis_browser_actions_form_submit()
  4. 7 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) {
        _cmis_browser_actions_content_create($path, $file->filename, file_get_contents(drupal_realpath($file->uri)), $file->filemime);
      }
      else {
        form_set_error('content_upload', t('Unable to handle uploaded file.'));
      }
      break;
  }
}