diff --git a/calendar/inc/class.calendar_ui.inc.php b/calendar/inc/class.calendar_ui.inc.php
index ad79443e75..95e0b6bc6a 100644
--- a/calendar/inc/class.calendar_ui.inc.php
+++ b/calendar/inc/class.calendar_ui.inc.php
@@ -813,20 +813,17 @@ function load_cal(url,id) {
if ($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir'])
{
$options = '';
- $documents = calendar_merge::get_documents($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']);
-
- // Skip spreadsheets that are in the other selectbox
- $spreadsheets = importexport_admin_prefs_sidebox_hooks::get_spreadsheet_list('calendar');
- foreach($spreadsheets as $file_info)
+ if ($GLOBALS['egw_info']['user']['apps']['importexport'])
{
- if($key = array_search($file_info['name'], $documents))
- {
- unset($documents[$key]);
- }
+ $mime_filter = array('!', // negativ filter, everything but ...
+ 'application/vnd.oasis.opendocument.spreadsheet',
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
+ );
}
+ $documents = calendar_merge::get_documents($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir'], '', $mime_filter);
foreach($documents as $key => $value)
{
- $options .= '\n";
+ $options .= '\n";
}
if($options != '') {
$options = '\n" . $options;
@@ -896,13 +893,8 @@ function load_cal(url,id) {
'end' => is_array($this->last) ? $this->bo->date2ts($this->last) : $this->last
));
}
- if($_GET['merge'][0] != '/') {
- list($document, $filename) = explode('_',$_GET['merge'], 2);
- } else {
- $filename = $_GET['merge'];
- }
$merge = new calendar_merge();
- return $merge->download($filename, $timespan, '', $GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']);
+ return $merge->download($_GET['merge'], $timespan, '', $GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']);
}
return false;
}
diff --git a/calendar/inc/class.calendar_uilist.inc.php b/calendar/inc/class.calendar_uilist.inc.php
index 4b8a015186..c76ca73b8a 100644
--- a/calendar/inc/class.calendar_uilist.inc.php
+++ b/calendar/inc/class.calendar_uilist.inc.php
@@ -789,12 +789,12 @@ class calendar_uilist extends calendar_ui
'hint' => 'Download this event as iCal',
'disableClass' => 'rowNoView',
);
-
+/* not working, needs fixing
$actions['documents'] = addressbook_merge::document_action(
$this->bo->cal_prefs['document_dir'], ++$group, 'Insert in document', 'document_',
$this->bo->cal_prefs['default_document']
);
-
+*/
++$group;
$actions['delete'] = array(
'caption' => 'Delete',
diff --git a/etemplate/inc/class.bo_merge.inc.php b/etemplate/inc/class.bo_merge.inc.php
index 9ff5541704..adbfcc3597 100644
--- a/etemplate/inc/class.bo_merge.inc.php
+++ b/etemplate/inc/class.bo_merge.inc.php
@@ -883,7 +883,7 @@ abstract class bo_merge
*
* @param string $dirs Directory(s comma or space separated) to search
* @param string $prefix='document_' prefix for array keys
- * @param array|string $mime_filter=null allowed mime type(s), default all
+ * @param array|string $mime_filter=null allowed mime type(s), default all, negative filter if $mime_filter[0] === '!'
* @return array List of documents, suitable for a selectbox. The key is document_.
*/
public static function get_documents($dirs, $prefix='document_', $mime_filter=null)
@@ -896,6 +896,17 @@ abstract class bo_merge
{
foreach($dirs as $n => &$d) if ($n) $d = '/'.$d; // re-adding trailing slash removed by split
}
+ if ($mime_filter && ($negativ_filter = $mime_filter[0] === '!'))
+ {
+ if (is_array($mime_filter))
+ {
+ unset($mime_filter[0]);
+ }
+ else
+ {
+ $mime_filter = substr($mime_filter, 1);
+ }
+ }
$list = array();
foreach($dirs as $dir)
{
@@ -905,8 +916,7 @@ abstract class bo_merge
{
// return only the mime-types we support
if (!self::is_implemented($file['mime'],'.'.array_pop($parts=explode('.',$file['name'])))) continue;
- if ($mime_filter && !in_array($file['mime'], (array)$mime_filter)) continue;
-
+ if ($mime_filter && $negativ_filter === in_array($file['mime'], (array)$mime_filter)) continue;
$list[$prefix.$file['name']] = egw_vfs::decodePath($file['name']);
}
}