forked from YesWiki/yeswiki-extension-publication
-
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.
Display a sneak peak of a publication instead of its rendered HTML
refs YesWiki#18
- Loading branch information
Thomas Parisot
committed
Sep 22, 2020
1 parent
229ede9
commit 5b3ed31
Showing
6 changed files
with
84 additions
and
5 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
global $wiki; | ||
|
||
if ($this->HasAccess('write') && isset($this->page['metadatas']['publication-title'])) { | ||
$wiki->AddCSSFile('tools/publication/presentation/styles/publication.css'); | ||
$wiki->page['body'] = '{{button link="'.$wiki->href('pdf', '').'" text="PDF" class="btn-primary pull-right space-left" icon="fas fa-book"}} {{button link="'.$wiki->href('preview', '').'" text="'._t('PUBLICATION_PREVIEW').'" class="btn-info pull-right" icon="fas fa-book-reader"}}""<div class="clearfix"></div>""'.$wiki->page['body']; | ||
} |
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,29 @@ | ||
<?php | ||
global $wiki; | ||
|
||
if ($this->HasAccess('write') && isset($this->page['metadatas']['publication-title'])) { | ||
include_once 'includes/squelettephp.class.php'; | ||
|
||
// user options | ||
$options = array( | ||
"publication-hide-links-url" => '1', | ||
"publication-cover-page" => '0', | ||
"publication-book-fold" => '0', | ||
"publication-page-format" => 'A4', | ||
"publication-page-orientation" => 'portrait', | ||
"publication-pagination" => "bottom-center", | ||
"publication-print-marks" => '0' | ||
); | ||
|
||
$metadata = array_merge($options, $wiki->page['metadatas']); | ||
$template = new SquelettePhp('print-show.tpl.html', 'publication'); | ||
|
||
$output = $template->render(array( | ||
'hasWriteAccess' => $wiki->HasAccess('write'), | ||
'metadata' => $metadata, | ||
'page' => $wiki->page, | ||
'wiki' => $wiki, | ||
)); | ||
|
||
$plugin_output_new = preg_replace('/<div class="page" >.+<hr class="hr_clear" \/>/siU', '<div class="page" >'. $output .'<hr class="hr_clear" />', $plugin_output_new); | ||
} |
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
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
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
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,40 @@ | ||
<div class="alert alert-info"> | ||
<p><?php echo _t('PUBLICATION_SHOW_NOTICE') ?></p> | ||
</div> | ||
|
||
<div class="row yw-publication__show"> | ||
<div class="col-sm-8"> | ||
<div class="thumbnail"> | ||
<div class="caption"> | ||
<?php if ($metadata['publication-cover-image']) { ?> | ||
<img class="pull-right img-cover img-thumbnail" alt="" src="<?php echo $metadata['publication-cover-image'] ?>"> | ||
<?php } ?> | ||
|
||
<h3><?php echo $metadata['publication-title'] ?></h3> | ||
|
||
<p class="clearfix"><?php echo $metadata['publication-description'] ?></p> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="col-sm-4"> | ||
<div class="btn-group-vertical" role="group" aria-label=""> | ||
<a href="<?php echo $wiki->href('pdf', '') ?>" download type="application/pdf" class="btn btn-primary"> | ||
<i class="fas fa-book"></i> | ||
<?php echo _t('PUBLICATION_VIEW_PDF') ?> | ||
</a> | ||
|
||
<?php if ($hasWriteAccess) { ?> | ||
<a href="<?php echo $wiki->href('preview', '') ?>" class="btn btn-default btn-secondary"> | ||
<i class="fas fa-book-reader"></i> | ||
<?php echo _t('PUBLICATION_PREVIEW') ?> | ||
</a> | ||
<?php } ?> | ||
|
||
<a href="<?php echo $wiki->href('share', '') ?>" class="btn btn-default btn-secondary"> | ||
<i class="fas fa-share-alt"></i> | ||
<?php echo _t('TEMPLATE_SHARE') ?> | ||
</a> | ||
</div> | ||
</div> | ||
</div> |