From 77c77749b3ee93f73da466322d154bdc6e812669 Mon Sep 17 00:00:00 2001 From: Mikhail Sokolovskiy Date: Tue, 3 Feb 2015 16:41:33 +0200 Subject: [PATCH 1/2] Added Acadre stream wrapper --- os2web_acadre_esdh.module | 47 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/os2web_acadre_esdh.module b/os2web_acadre_esdh.module index 519c6aa..b2329d8 100644 --- a/os2web_acadre_esdh.module +++ b/os2web_acadre_esdh.module @@ -7,9 +7,12 @@ include_once('os2web_acadre_esdh.features.inc'); -define('ACADRE_MM_IMPORT_DIR', 'public://acadre'); +define('ACADRE_MM_IMPORT_DIR', 'acadre://'); define('ACADRE_MM_DEFAULT_APPROVED', '62,59,64,53,54,56,57,63,58,51,55,61,68,69,42'); +// MM settings. +define('MM_USE_ALTERNATIVE_FILE_URI_SCHEME', TRUE); + /** * Implements hook_ctools_plugin_directory(). * @@ -149,3 +152,45 @@ function os2web_acadre_esdh_os2web_help($sections) { // return t('Missing documentation.'); // } //} + +/** + * Implements hook_stream_wrappers(). + * + * Custom Acadre stream wrapper to avoid problems when moving files. + */ +function os2web_acadre_esdh_stream_wrappers() { + return array( + 'acadre' => array( + 'name' => t('Acadre'), + 'class' => 'AcadreStreamWrapper', + 'description' => t('Stream wrapper to the Acadre ESDH integration.'), + 'type' => STREAM_WRAPPERS_LOCAL_HIDDEN, + ), + ); +} + +/** + * Acadre (acadre://) stream wrapper class. + * + * Provides support for storing Acadre documents with the Drupal file + * interface. + */ +class AcadreStreamWrapper extends DrupalPublicStreamWrapper { + + /** + * {@inheritdoc} + */ + public function getDirectoryPath() { + $path = variable_get('os2web_acadre_stream_wrapper_path', 'acadre'); + $path = $path ? '/' . $path : ''; + return parent::getDirectoryPath() . $path; + } + + /** + * {@inheritdoc} + */ + public function getExternalUrl() { + $path = str_replace('\\', '/', $this->getTarget()); + return $GLOBALS['base_url'] . '/' . self::getDirectoryPath() . '/' . drupal_encode_path($path); + } +} From 4c27b7e83d1461a7000808fe69337b4d6fa3373b Mon Sep 17 00:00:00 2001 From: Mikhail Sokolovskiy Date: Tue, 3 Feb 2015 18:08:28 +0200 Subject: [PATCH 2/2] Added OS2Web Acadre ESDH text format --- os2web_acadre_esdh.features.filter.inc | 46 ++++++++++++++++++++++++++ os2web_acadre_esdh.info | 3 +- os2web_acadre_esdh.module | 4 +-- 3 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 os2web_acadre_esdh.features.filter.inc diff --git a/os2web_acadre_esdh.features.filter.inc b/os2web_acadre_esdh.features.filter.inc new file mode 100644 index 0000000..b5dd500 --- /dev/null +++ b/os2web_acadre_esdh.features.filter.inc @@ -0,0 +1,46 @@ + 'os2web_acadre_esdh', + 'name' => 'OS2Web Acadre ESDH', + 'cache' => 1, + 'status' => 1, + 'weight' => 0, + 'filters' => array( + 'filter_url' => array( + 'weight' => -50, + 'status' => 1, + 'settings' => array( + 'filter_url_length' => 72, + ), + ), + 'filter_html' => array( + 'weight' => -49, + 'status' => 1, + 'settings' => array( + 'allowed_html' => '