/**
  * Delete document action
  *
  * @param void
  * @return void
  */
 function delete()
 {
     if ($this->active_document->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if (!$this->active_document->canDelete($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     if ($this->request->isSubmitted()) {
         db_begin_work();
         $delete = $this->active_document->delete();
         if ($delete && !is_error($delete)) {
             db_commit();
             flash_success('Document ":document_name" has been deleted', array('document_name' => $this->active_document->getName()));
         } else {
             db_rollback();
             flash_error('Failed to delete ":document_name"', array('document_name' => $this->active_document->getName()));
         }
         // if
         $this->redirectTo('documents');
     } else {
         $this->httpError(HTTP_BAD_REQUEST);
     }
     // if
 }