Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

embed media as file annotation #51

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions conf/default.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
$conf['attachment'] = 1;
$conf['pagesize'] = 'A4';
$conf['orientation'] = 'portrait';
$conf['doublesided'] = 1;
Expand Down
1 change: 1 addition & 0 deletions conf/metadata.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
$meta['attachment'] = array('onoff');
$meta['pagesize'] = array('string');
$meta['orientation'] = array('multichoice', '_choices' => array('portrait', 'landscape'));
$meta['doublesided'] = array('onoff');
Expand Down
1 change: 1 addition & 0 deletions lang/de/lang.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
$lang['empty'] = 'Sie haben noch keine Seiten gewählt.';
$lang['tocheader'] = 'Inhaltsverzeichnis';
$lang['export_ns'] = 'Exportiere Namensraum "%s:" in Datei %s.pdf';
$lang["mediatitle"] = "Anhang: %s";
3 changes: 3 additions & 0 deletions lang/de/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @author Matthias Schulte <[email protected]>
* @author Juergen-aus-Koeln <[email protected]>
*/

$lang['attachment'] = 'Verlinkte Dateien einbetten';
$lang['pagesize'] = 'Ein von mPDF unterstütztes Seitenformat. Normalerweise <code>A4</code> oder <code>letter</code>.';
$lang['orientation'] = 'Die Seiten-Ausrichtung';
$lang['orientation_o_portrait'] = 'Hochformat';
Expand All @@ -22,3 +24,4 @@
$lang['usestyles'] = 'Hier können komma-separiert Plugins angegeben werden, von denen die <code>style.css</code> oder <code>screen.css</code> für die PDF-Generierung verwendet werden sollen. Als Standard wird nur die <code>print.css</code> und <code>pdf.css</code> verwendet.';
$lang['qrcodesize'] = 'Größe des eingebetteten QR-Codes (in Pixeln <code><i>width</i><b>x</b><i>height</i></code>. Leer lassen zum Deaktivieren.';
$lang['showexportbutton'] = 'Zeige PDF Export Button (nur wenn vom Template unterstützt)';

1 change: 1 addition & 0 deletions lang/en/lang.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

$lang["mediatitle"] = "Attachment: %s";
$lang['export_pdf_button'] = "Export to PDF";
$lang['needtitle'] = "Please provide a title.";
$lang['needns'] = "Please provide an existing namespace.";
Expand Down
1 change: 1 addition & 0 deletions lang/en/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

// for the configuration manager

$lang['attachment'] = 'Embed linked media';
$lang['pagesize'] = 'The page format as supported by mPDF. Usually <code>A4</code> or <code>letter</code>.';
$lang['orientation'] = 'The page orientation.';
$lang['orientation_o_portrait'] = 'Portrait';
Expand Down
10 changes: 10 additions & 0 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ function _media ($src, $title=NULL, $align=NULL, $width=NULL,
$out .= '<div align="center" style="text-align: center">';
}

$NS = getNS($src);
$AUTH = auth_quickaclcheck("$NS:*");
$confAttachment = $this->getConf('attachment');
if($AUTH >= AUTH_READ && $confAttachment) {
$file = mediaFN($src);
$filename = basename($file);
$mediatitle = sprintf($this->getLang('mediatitle'), $filename);
$out .= "<annotation file=\"".htmlspecialchars($file)."\" content=\"".htmlspecialchars($title)."\" icon=\"Paperclip\" title=\"".htmlspecialchars($mediatitle)."\"/>&nbsp;&nbsp;&nbsp;";
}

$out .= parent::_media ($src, $title, $align, $width, $height, $cache, $render);

if($align == 'center'){
Expand Down