fixed some printing stuff in calendar, printing in listview is disabled, because it is NOT working atm.

This commit is contained in:
Ralf Becker 2011-06-17 15:16:40 +00:00
parent 6cf426d465
commit 65a8e4e8d3
3 changed files with 23 additions and 21 deletions

View File

@ -813,20 +813,17 @@ function load_cal(url,id) {
if ($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']) if ($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir'])
{ {
$options = ''; $options = '';
$documents = calendar_merge::get_documents($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']); if ($GLOBALS['egw_info']['user']['apps']['importexport'])
// Skip spreadsheets that are in the other selectbox
$spreadsheets = importexport_admin_prefs_sidebox_hooks::get_spreadsheet_list('calendar');
foreach($spreadsheets as $file_info)
{ {
if($key = array_search($file_info['name'], $documents)) $mime_filter = array('!', // negativ filter, everything but ...
{ 'application/vnd.oasis.opendocument.spreadsheet',
unset($documents[$key]); '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) foreach($documents as $key => $value)
{ {
$options .= '<option value="'.$key.'">'.html::htmlspecialchars($value)."</option>\n"; $options .= '<option value="'.html::htmlspecialchars($key).'">'.html::htmlspecialchars($value)."</option>\n";
} }
if($options != '') { if($options != '') {
$options = '<option value="">'.lang('Insert in document')."</option>\n" . $options; $options = '<option value="">'.lang('Insert in document')."</option>\n" . $options;
@ -896,13 +893,8 @@ function load_cal(url,id) {
'end' => is_array($this->last) ? $this->bo->date2ts($this->last) : $this->last '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(); $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; return false;
} }

View File

@ -789,12 +789,12 @@ class calendar_uilist extends calendar_ui
'hint' => 'Download this event as iCal', 'hint' => 'Download this event as iCal',
'disableClass' => 'rowNoView', 'disableClass' => 'rowNoView',
); );
/* not working, needs fixing
$actions['documents'] = addressbook_merge::document_action( $actions['documents'] = addressbook_merge::document_action(
$this->bo->cal_prefs['document_dir'], ++$group, 'Insert in document', 'document_', $this->bo->cal_prefs['document_dir'], ++$group, 'Insert in document', 'document_',
$this->bo->cal_prefs['default_document'] $this->bo->cal_prefs['default_document']
); );
*/
++$group; ++$group;
$actions['delete'] = array( $actions['delete'] = array(
'caption' => 'Delete', 'caption' => 'Delete',

View File

@ -883,7 +883,7 @@ abstract class bo_merge
* *
* @param string $dirs Directory(s comma or space separated) to search * @param string $dirs Directory(s comma or space separated) to search
* @param string $prefix='document_' prefix for array keys * @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_<filename>. * @return array List of documents, suitable for a selectbox. The key is document_<filename>.
*/ */
public static function get_documents($dirs, $prefix='document_', $mime_filter=null) 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 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(); $list = array();
foreach($dirs as $dir) foreach($dirs as $dir)
{ {
@ -905,8 +916,7 @@ abstract class bo_merge
{ {
// return only the mime-types we support // return only the mime-types we support
if (!self::is_implemented($file['mime'],'.'.array_pop($parts=explode('.',$file['name'])))) continue; 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']); $list[$prefix.$file['name']] = egw_vfs::decodePath($file['name']);
} }
} }