Fixed #5. Default zoom level's can now be defined for PDF and ODF documents.

This commit is contained in:
Christoph Haas 2015-06-17 15:49:42 +02:00
parent 94d4b9ed70
commit df647f6b74
3 changed files with 30 additions and 5 deletions

View File

@ -1,3 +1,20 @@
<?php <?php
/**
* Enable this plugin by default for all users. (default: true)
*/
define('PLUGIN_FILEVIEWER_USER_DEFAULT_ENABLE', true); define('PLUGIN_FILEVIEWER_USER_DEFAULT_ENABLE', true);
?>
/**
* #########################
* ADVANCED SECTION
* #########################
*/
/**
* Default zoom mode for PDF documents. (default: page-width) [Allowed: "auto", "page-actual", "page-width"]
*/
define('PLUGIN_FILEVIEWER_PDF_DEFAULT_ZOOM', "page-width");
/**
* Default zoom mode for ODF documents. (default: page-width) [Allowed: "auto", "page-actual", "page-width"]
*/
define('PLUGIN_FILEVIEWER_ODF_DEFAULT_ZOOM', "auto");

View File

@ -172,7 +172,14 @@ Zarafa.plugins.fileviewer.ViewerPanel = Ext.extend(Ext.Panel, {
var options = ''; var options = '';
if(Ext.isDefined(extension)) { if(Ext.isDefined(extension)) {
options = '?type=' + extension; if (extension === 'pdf'){
options += '?zoom=' + container.getSettingsModel().get('zarafa/v1/plugins/fileviewer/config_pdf_default_zoom');
} else if((/(od[tps])$/i).test(extension)) {
options += '?zoom=' + container.getSettingsModel().get('zarafa/v1/plugins/fileviewer/config_odf_default_zoom');
} else {
options += '?zoom=auto';
}
options += '&type=' + extension;
} }
return pluginRoot + this.viewerjsPath + options + '#' + url; return pluginRoot + this.viewerjsPath + options + '#' + url;

View File

@ -48,7 +48,9 @@ class PluginFileviewer extends Plugin {
'v1' => Array( 'v1' => Array(
'plugins' => Array( 'plugins' => Array(
'fileviewer' => Array( 'fileviewer' => Array(
'enable' => PLUGIN_FILEVIEWER_USER_DEFAULT_ENABLE 'enable' => PLUGIN_FILEVIEWER_USER_DEFAULT_ENABLE,
'config_pdf_default_zoom' => PLUGIN_FILEVIEWER_PDF_DEFAULT_ZOOM,
'config_odf_default_zoom' => PLUGIN_FILEVIEWER_ODF_DEFAULT_ZOOM,
) )
) )
) )
@ -56,4 +58,3 @@ class PluginFileviewer extends Plugin {
)); ));
} }
} }
?>