-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9831ad6
Showing
20 changed files
with
427 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<?php | ||
|
||
/** | ||
* @version $Id$ | ||
* @license http://www.gnu.org/licenses/gpl-3.0.txt | ||
* @copyright Daniele Binaghi, 2019 | ||
* @package MoreMediaTypes | ||
*/ | ||
|
||
class MoreMediaTypesPlugin extends Omeka_Plugin_AbstractPlugin | ||
{ | ||
const MIME_MS_DOC = "application/msword"; | ||
const MIME_MS_XLS = "application/vnd.ms-excel"; | ||
const MIME_MS_PPT = "application/vnd.ms-powerpoint"; | ||
const MIME_MS_DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; | ||
const MIME_MS_XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; | ||
const MIME_MS_PPTX = "application/vnd.openxmlformats-officedocument.presentationml.presentation"; | ||
const MIME_OOO_ODT = "application/vnd.oasis.opendocument.text"; | ||
const MIME_OOO_SXC = "application/vnd.sun.xml.calc"; | ||
const MIME_OOO_SXI = "application/vnd.sun.xml.impress"; | ||
const MIME_TEXT = "text/plain"; | ||
const MIME_HTML = "text/html"; | ||
const MIME_ZIP = "application/zip"; | ||
const MIME_ARJ = "application/arj"; | ||
const MIME_PDF = "application/pdf"; | ||
const MIME_AUDIO = "audio"; | ||
const MIME_IMAGE = "image"; | ||
const MIME_VIDEO = "video"; | ||
|
||
protected $_hooks = array( | ||
'install', | ||
'uninstall', | ||
'initialize', | ||
'config', | ||
'config_form' | ||
); | ||
|
||
public function hookInstall() | ||
{ | ||
set_option('more_media_types_msofficeformats', '0'); | ||
set_option('more_media_types_msofficexformats', '0'); | ||
set_option('more_media_types_openofficeformats', '0'); | ||
set_option('more_media_types_text', '0'); | ||
set_option('more_media_types_html', '0'); | ||
set_option('more_media_types_pdf', '0'); | ||
set_option('more_media_types_compressed', '0'); | ||
set_option('more_media_types_replacestandardicons', '0'); | ||
} | ||
|
||
public function hookUninstall() | ||
{ | ||
delete_option('more_media_types_msofficeformats'); | ||
delete_option('more_media_types_msofficexformats'); | ||
delete_option('more_media_types_openofficeformats'); | ||
delete_option('more_media_types_text'); | ||
delete_option('more_media_types_html'); | ||
delete_option('more_media_types_pdf'); | ||
delete_option('more_media_types_compressed'); | ||
delete_option('more_media_types_replacestandardicons'); | ||
} | ||
|
||
public function hookInitialize() | ||
{ | ||
add_translation_source(dirname(__FILE__) . '/languages'); | ||
|
||
if (get_option(more_media_types_msofficeformats)) { | ||
add_file_fallback_image(self::MIME_MS_DOC, "fallback-ms_word.png"); | ||
add_file_fallback_image(self::MIME_MS_XLS, "fallback-ms_excel.png"); | ||
add_file_fallback_image(self::MIME_MS_PPT, "fallback-ms_powerpoint.png"); | ||
} | ||
if (get_option(more_media_types_msofficexformats)) { | ||
add_file_fallback_image(self::MIME_MS_DOCX, "fallback-ms_word.png"); | ||
add_file_fallback_image(self::MIME_MS_XLSX, "fallback-ms_excel.png"); | ||
add_file_fallback_image(self::MIME_MS_PPTX, "fallback-ms_powerpoint.png"); | ||
} | ||
if (get_option(more_media_types_openofficeformats)) { | ||
add_file_fallback_image(self::MIME_OOO_ODT, "fallback-ooo_writer.png"); | ||
add_file_fallback_image(self::MIME_OOO_SXC, "fallback-ooo_calc.png"); | ||
add_file_fallback_image(self::MIME_OOO_SXI, "fallback-ooo_impress.png"); | ||
} | ||
if (get_option(more_media_types_html)) add_file_fallback_image(self::MIME_HTML, "fallback-html.png"); | ||
if (get_option(more_media_types_text)) add_file_fallback_image(self::MIME_TEXT, "fallback-text.png"); | ||
if (get_option(more_media_types_pdf)) add_file_fallback_image(self::MIME_PDF, "fallback-pdf.png"); | ||
if (get_option(more_media_types_compressed)) { | ||
add_file_fallback_image(self::MIME_ZIP, "fallback-compressed.png"); | ||
add_file_fallback_image(self::MIME_ARJ, "fallback-compressed.png"); | ||
} | ||
if (get_option(more_media_types_replacestandardicons)) { | ||
add_file_fallback_image(self::MIME_AUDIO, "fallback-audio1.png"); | ||
add_file_fallback_image(self::MIME_IMAGE, "fallback-image1.png"); | ||
add_file_fallback_image(self::MIME_VIDEO, "fallback-video1.png"); | ||
} | ||
} | ||
|
||
public function hookConfig($args) | ||
{ | ||
$post = $args['post']; | ||
set_option('more_media_types_msofficeformats', $post['more_media_types_msofficeformats']); | ||
set_option('more_media_types_msofficexformats', $post['more_media_types_msofficexformats']); | ||
set_option('more_media_types_openofficeformats', $post['more_media_types_openofficeformats']); | ||
set_option('more_media_types_text', $post['more_media_types_text']); | ||
set_option('more_media_types_html', $post['more_media_types_html']); | ||
set_option('more_media_types_pdf', $post['more_media_types_pdf']); | ||
set_option('more_media_types_compressed', $post['more_media_types_text']); | ||
set_option('more_media_types_replacestandardicons', $post['more_media_types_replacestandardicons']); | ||
} | ||
|
||
public function hookConfigForm() | ||
{ | ||
include 'config_form.php'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# More Media Types | ||
|
||
## Description | ||
|
||
Plugin for Omeka Classic. Once installed and active, allows users to add new shiny fallback thumbnails for extra media types (PDF, Ms-Office, Open Office, compressed files etc.), as well as default icons (video, picture, text). | ||
|
||
Available new types: | ||
- Microsoft Office Word, Excel e PowerPoint; | ||
- Microsoft Office Word, Excel e PowerPoint (XML versions); | ||
- Open Office Writer, Calc e Impress; | ||
- TXT; | ||
- HyperText Markup Language (HTML); | ||
- Adobe's Portable Document Format (PDF); | ||
- compressed files: ZIP and ARJ. | ||
|
||
## Installation | ||
Uncompress files and rename plugin folder "MoreMediaTypes". | ||
|
||
Then install it like any other Omeka plugin. | ||
|
||
## Warning | ||
Use it at your own risk. | ||
|
||
It’s always recommended to backup your files and your databases and to check your archives regularly so you can roll back if needed. | ||
|
||
## Troubleshooting | ||
See online issues on the <a href="https://github.com/DBinaghi/plugin-MoreMediaTypes/issues" target="_blank">plugin issues</a> page on GitHub. | ||
|
||
## License | ||
This plugin is published under the <a href="https://www.cecill.info/licences/Licence_CeCILL_V2.1-en.html" target="_blank">CeCILL v2.1</a> licence, compatible with <a href="https://www.gnu.org/licenses/gpl-3.0.html" target="_blank">GNU/GPL</a> and approved by <a href="https://www.fsf.org/" target="_blank">FSF</a> and <a href="http://opensource.org/" target="_blank">OSI</a>. | ||
|
||
In consideration of access to the source code and the rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software’s author, the holder of the economic rights, and the successive licensors only have limited liability. | ||
|
||
In this respect, the risks associated with loading, using, modifying and/or developing or reproducing the software by the user are brought to the user’s attention, given its Free Software status, which may make it complicated to use, with the result that its use is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the suitability of the software as regards their requirements in conditions enabling the security of their systems and/or data to be ensured and, more generally, to use and operate it in the same conditions of security. This Agreement may be freely reproduced and published, provided it is not altered, and that no provisions are either added or removed herefrom. | ||
|
||
## Copyright | ||
Copyright Daniele Binaghi, 2019-2020 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<?php | ||
$ms_office_formats = get_option('more_media_types_msofficeformats'); | ||
$ms_office_x_formats = get_option('more_media_types_msofficexformats'); | ||
$open_office_formats = get_option('more_media_types_openofficeformats'); | ||
$text_format = get_option('more_media_types_text'); | ||
$html_format = get_option('more_media_types_html'); | ||
$pdf_format = get_option('more_media_types_pdf'); | ||
$compressed_format = get_option('more_media_types_compressed'); | ||
$replace_standard_icons = get_option('more_media_types_replacestandardicons'); | ||
$view = get_view(); | ||
?> | ||
|
||
<h2><?php echo __('Formati Microsoft Office'); ?></h2> | ||
|
||
<div class="field"> | ||
<div class="two columns alpha"> | ||
<?php echo $view->formLabel('more_media_types_msofficeformats', __('Aggiunge formati standard')); ?> | ||
</div> | ||
<div class="inputs five columns omega"> | ||
<p class="explanation"> | ||
<?php echo __('Se selezionata, aggiunge le icone per i formati standard Microsoft Office: Word, Excel e PowerPoint.'); ?> | ||
</p> | ||
<?php echo $view->formCheckbox('more_media_types_msofficeformats', $ms_office_formats, null, array('1', '0')); ?> | ||
</div> | ||
</div> | ||
|
||
<div class="field"> | ||
<div class="two columns alpha"> | ||
<?php echo $view->formLabel('more_media_types_msofficexformats', __('Aggiunge formati xml')); ?> | ||
</div> | ||
<div class="inputs five columns omega"> | ||
<p class="explanation"> | ||
<?php echo __('Se selezionata, aggiunge le icone per i formati xml Microsoft Office di Word, Excel e PowerPoint (attenzione: verificare che il tipo di media sia accettato nella configurazione di Omeka)'); ?> | ||
</p> | ||
<?php echo $view->formCheckbox('more_media_types_msofficexformats', $ms_office_x_formats, null, array('1', '0')); ?> | ||
</div> | ||
</div> | ||
|
||
<h2><?php echo __('Formati Open Office'); ?></h2> | ||
|
||
<div class="field"> | ||
<div class="two columns alpha"> | ||
<?php echo $view->formLabel('more_media_types_openofficeformats', __('Aggiunge formati standard')); ?> | ||
</div> | ||
<div class="inputs five columns omega"> | ||
<p class="explanation"> | ||
<?php echo __('Se selezionata, aggiunge le icone per i formati standard Open Office: Writer, Calc e Impress.'); ?> | ||
</p> | ||
<?php echo $view->formCheckbox('more_media_types_openofficeformats', $open_office_formats, null, array('1', '0')); ?> | ||
</div> | ||
</div> | ||
|
||
<h2><?php echo __('Altri formati'); ?></h2> | ||
|
||
<div class="field"> | ||
<div class="two columns alpha"> | ||
<?php echo $view->formLabel('more_media_types_text', __('Aggiunge formato testo')); ?> | ||
</div> | ||
<div class="inputs five columns omega"> | ||
<p class="explanation"> | ||
<?php echo __('Se selezionata, aggiunge una icona per il formato testo.'); ?> | ||
</p> | ||
<?php echo $view->formCheckbox('more_media_types_text', $text_format, null, array('1', '0')); ?> | ||
</div> | ||
</div> | ||
|
||
<div class="field"> | ||
<div class="two columns alpha"> | ||
<?php echo $view->formLabel('more_media_types_html', __('Aggiunge formato HTML')); ?> | ||
</div> | ||
<div class="inputs five columns omega"> | ||
<p class="explanation"> | ||
<?php echo __('Se selezionata, aggiunge una icona per il formato HTML.'); ?> | ||
</p> | ||
<?php echo $view->formCheckbox('more_media_types_html', $html_format, null, array('1', '0')); ?> | ||
</div> | ||
</div> | ||
|
||
<div class="field"> | ||
<div class="two columns alpha"> | ||
<?php echo $view->formLabel('more_media_types_pdf', __('Aggiunge formato PDF')); ?> | ||
</div> | ||
<div class="inputs five columns omega"> | ||
<p class="explanation"> | ||
<?php echo __('Se selezionata, aggiunge una icona per il formato PDF.'); ?> | ||
</p> | ||
<?php echo $view->formCheckbox('more_media_types_pdf', $pdf_format, null, array('1', '0')); ?> | ||
</div> | ||
</div> | ||
|
||
<div class="field"> | ||
<div class="two columns alpha"> | ||
<?php echo $view->formLabel('more_media_types_compressed', __('Aggiunge formati compressi')); ?> | ||
</div> | ||
<div class="inputs five columns omega"> | ||
<p class="explanation"> | ||
<?php echo __('Se selezionata, aggiunge una icona per i formati compressi ZIP e ARJ.'); ?> | ||
</p> | ||
<?php echo $view->formCheckbox('more_media_types_compressed', $compressed_format, null, array('1', '0')); ?> | ||
</div> | ||
</div> | ||
|
||
<h2><?php echo __('Icone standard'); ?></h2> | ||
|
||
<div class="field"> | ||
<div class="two columns alpha"> | ||
<?php echo $view->formLabel('more_media_types_replacestandardicons', __('Sostituisce icone standard')); ?> | ||
</div> | ||
<div class="inputs five columns omega"> | ||
<p class="explanation"> | ||
<?php echo __('Se selezionata, sostituisce le icone standard per i formati Image, Audio, Video e quella di default.'); ?> | ||
</p> | ||
<?php echo $view->formCheckbox('more_media_types_replacestandardicons', $replace_standard_icons, null, array('1', '0')); ?> | ||
</div> | ||
</div> |
Binary file not shown.
Oops, something went wrong.