François
7 months ago
8 changed files with 218 additions and 0 deletions
@ -1,2 +1,5 @@ |
|||
# tile |
|||
|
|||
DokuWiki Extensions : https://www.dokuwiki.org/plugin:tile |
|||
|
|||
Membership directory in the form of a thumbnail. |
|||
|
@ -0,0 +1,7 @@ |
|||
<?php |
|||
/** |
|||
* Options for the Tile Plugin |
|||
*/ |
|||
$conf['iconSize'] = 80; // the icon size |
|||
$conf['sampleDelai'] = 2*60*60; |
|||
?> |
@ -0,0 +1,11 @@ |
|||
<?php |
|||
/** |
|||
* @license http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.html |
|||
* @author Francois Merciol <dokuplugin@merciol.fr> |
|||
* |
|||
* Metadata for configuration manager plugin |
|||
* Additions for the tile plugin |
|||
*/ |
|||
$meta['iconSize'] = array('numeric'); |
|||
$meta['sampleDelai'] = array('numeric'); |
|||
?> |
@ -0,0 +1,12 @@ |
|||
<?php |
|||
/** |
|||
* @license http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.html |
|||
* @author Francois Merciol <dokuplugin@merciol.fr> |
|||
* |
|||
* English language file |
|||
*/ |
|||
|
|||
// for the configuration tile plugin |
|||
$lang['iconSize'] = 'tile icon size'; |
|||
$lang['sampleDelai'] = 'cache time delay for sample (sec)'; |
|||
?> |
@ -0,0 +1,12 @@ |
|||
<?php |
|||
/** |
|||
* @license http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.html |
|||
* @author Francois Merciol <dokuplugin@merciol.fr> |
|||
* |
|||
* French language file |
|||
*/ |
|||
|
|||
// for the configuration tile plugin |
|||
$lang['iconSize'] = 'taille de l\'icon de tuile'; |
|||
$lang['sampleDelai'] = 'temps de cache pour l\'exemple (en secondes)'; |
|||
?> |
@ -0,0 +1,7 @@ |
|||
base tile |
|||
author Francois Merciol |
|||
email dokuplugin@merciol.fr |
|||
date 2020-07-20 |
|||
name Tile plugin |
|||
desc Display URL in tile |
|||
url http://www.dokuwiki.org/plugin:tile |
@ -0,0 +1,54 @@ |
|||
div.tiles { |
|||
background: #E8E8E8; |
|||
display: block; |
|||
padding: 0.5em; |
|||
text-align: center; |
|||
} |
|||
|
|||
div.tile { |
|||
background: #FFF; |
|||
display: inline-block; |
|||
padding: 0.5em; |
|||
margin: 0.5em; |
|||
width: 10em; |
|||
min-height: 15em; |
|||
text-align: center; |
|||
vertical-align: middle; |
|||
} |
|||
|
|||
div.tile a { |
|||
min-height: 2em; |
|||
} |
|||
|
|||
div.tile p { |
|||
margin: 0 ! important; |
|||
display: block; |
|||
min-height: 0; |
|||
} |
|||
|
|||
|
|||
div.tile div.img { |
|||
display: table-cell; |
|||
vertical-align: middle; |
|||
width: 9em; |
|||
height: 9em; |
|||
} |
|||
|
|||
div.tile div.img * { |
|||
vertical-align: middle; |
|||
} |
|||
/*\*//*/ |
|||
div.tile div.img { |
|||
display: block; |
|||
} |
|||
div.tile div.img span { |
|||
display: inline-block; |
|||
height: 100%; |
|||
width: 1px; |
|||
} |
|||
/**/ |
|||
|
|||
div.tile div.img img { |
|||
max-height: 9em; |
|||
max-width: 9em; |
|||
} |
@ -0,0 +1,112 @@ |
|||
<?php |
|||
/** |
|||
* @license http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.html |
|||
* @author Francois <dokuplugin@merciol.fr> |
|||
* |
|||
* Plugin touchtile: display URL in tiles |
|||
*/ |
|||
|
|||
if (!defined ('DOKU_INC')) |
|||
define ('DOKU_INC', realpath (dirname (__FILE__).'/../../').'/'); |
|||
if (!defined ('DOKU_PLUGIN')) |
|||
define ('DOKU_PLUGIN', DOKU_INC.'lib/plugins/'); |
|||
require_once(DOKU_PLUGIN.'syntax.php'); |
|||
|
|||
// ============================================================ |
|||
class syntax_plugin_tile extends DokuWiki_Syntax_Plugin { |
|||
|
|||
// ============================================================ |
|||
function getType () { return 'substition'; } |
|||
function getPType () { return 'block';} |
|||
function getSort () { return 299; } |
|||
function connectTo ($mode) { |
|||
$this->Lexer->addEntryPattern ('<tile[^>]*>', $mode, 'plugin_tile'); |
|||
} |
|||
function postConnect() { |
|||
$this->Lexer->addExitPattern ('</tile>', 'plugin_tile'); |
|||
} |
|||
|
|||
// ============================================================ |
|||
function handle ($match, $state, $pos, Doku_Handler $handler){ |
|||
switch ($state) { |
|||
case DOKU_LEXER_ENTER: |
|||
return array ($state, trim (substr ($match, 5, -1))); // "<title" => 5 ">" => 1 |
|||
case DOKU_LEXER_UNMATCHED: |
|||
return array ($state, $match); |
|||
case DOKU_LEXER_EXIT: |
|||
return array ($state); |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
var $iconSize; |
|||
var $imgAttr; |
|||
|
|||
// ============================================================ |
|||
function render ($mode, Doku_Renderer $renderer, $indata) { |
|||
if ($mode != 'xhtml') |
|||
return false; |
|||
if (empty ($indata)) |
|||
return false; |
|||
list ($instr, $data) = $indata; |
|||
switch ($instr) { |
|||
case DOKU_LEXER_ENTER : |
|||
if (preg_match_all ("#(\"[^\"]*\")*help(\"[^\"]*\")*#", $data, $dumy) > 0) |
|||
$this->help ($renderer); |
|||
$this->iconSize = $this->getConf ('iconSize'); |
|||
if (preg_match_all ("#(\"[^\"]*\")*width=\"(?<width>[^\"]*)\"(\"[^\"]*\")*#", $data, $dumy) > 0) |
|||
$this->iconSize = $dumy ['width'][0]; |
|||
$this->imgAttr = ' width="'.$this->iconSize.'"'; |
|||
$renderer->doc .= ' <div class="tiles">'; |
|||
break; |
|||
case DOKU_LEXER_EXIT : |
|||
$renderer->doc .= ' </div>'; |
|||
break; |
|||
case DOKU_LEXER_UNMATCHED : |
|||
$data = trim ($data); |
|||
if (empty ($data)) |
|||
return false; |
|||
global $_REQUEST; |
|||
foreach (explode ("\n", $data) as $line) { |
|||
$line = trim ($line); |
|||
if (!$line) |
|||
continue; |
|||
$line = preg_replace ("#\s+\|#", "|", $line); |
|||
$line = preg_replace ("#\|\s+#", "|", $line); |
|||
$line = trim ($line,'|'); |
|||
list ($id, $title, $img, $email, $name) = explode ("|", $line); |
|||
if (!$id) |
|||
continue; |
|||
$email = obfuscate ($email); |
|||
$mailto = $email ? '<a class="mail JSnocheck" href="mailto:'.$email.'" >'.($name ? $name : $email).'</a>' : ""; |
|||
$renderer->doc .= ' |
|||
<div class="tile"> |
|||
<a href="'.wl ($id).'"> |
|||
<p>'.$title.'</p> |
|||
<div class="img"><span></span><img src="'.ml ($img, array ('cache'=>$_REQUEST['cache'], 'w'=>$this->iconSize)).'"'.$this->imgAttr.' alt="'.$title.'"/></div> |
|||
</a> |
|||
<p>'.$mailto.'</p> |
|||
</div>'; |
|||
} |
|||
break; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
// ============================================================ |
|||
function help (Doku_Renderer $renderer) { |
|||
$url = "http://admin.parlenet.org/plugins/tile/"; |
|||
$renderer->doc .= |
|||
' <h1>Tile Help</h1>'.NL. |
|||
' <ul>'.NL. |
|||
' <li>Syntax : <b><tile [help] [width=pp]></b><br/>'. |
|||
' | :dokuwiki:namespace:page | Short Description | :dokuwiki:namespace:icon.png | member.mel@some.where.org | nickname |<br/>'. |
|||
' ...<br/>'. |
|||
' <b></tile></b></li>'.NL. |
|||
' <li>Info : <a class="urlextern" rel="nofollow" title="'.$url.'" href="'.$url.'">'.$url.'</a></li>'.NL. |
|||
' </ul>'.NL; |
|||
} |
|||
|
|||
// ============================================================ |
|||
} // syntax_plugin_tile |
|||
?> |
Loading…
Reference in new issue