You are here

function _cmis_browser_content_get_document in CMIS API 6.2

Same name and namespace in other branches
  1. 6.4 cmis_browser/cmis_browser.content_get.inc \_cmis_browser_content_get_document()
  2. 6.3 cmis_browser/cmis_browser.content_get.inc \_cmis_browser_content_get_document()
  3. 7.2 cmis_browser/cmis_browser.content_get.inc \_cmis_browser_content_get_document()
  4. 7 cmis_browser/cmis_browser.content_get.inc \_cmis_browser_content_get_document()

CMIS document download handler.

1 call to _cmis_browser_content_get_document()
cmis_browser_content_get in cmis_browser/cmis_browser.content_get.inc
Build cmis_browser browse page.

File

cmis_browser/cmis_browser.content_get.inc, line 40

Code

function _cmis_browser_content_get_document($repository, $object) {
  module_load_include('api.inc', 'cmis');
  try {
    $content = cmisapi_getContentStream($repository->repositoryId, $object->id);
  } catch (CMISException $e) {
    cmis_error_handler('cmis_browser_content_get', $e);
    drupal_set_header('HTTP/1.1 503 Service unavailable');
    exit;
  }
  if (ob_get_level()) {
    ob_end_clean();
  }
  drupal_set_header('Cache-Control: no-cache, must-revalidate');
  drupal_set_header('Content-type: ' . $object->contentMimeType);
  drupal_set_header('Content-Disposition: attachment; filename="' . $object->title . '"');
  print $content;
  exit;
}