Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1822390
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
2 KB
Subscribers
None
View Options
diff --git a/action.php b/action.php
--- a/action.php
+++ b/action.php
@@ -1,79 +1,79 @@
<?php
/**
* DokuWiki Plugin datapopup (Action Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andreas Boehler <dev@aboehler.at>
*/
// must be run within Dokuwiki
if (!defined('DOKU_INC')) die();
if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'action.php');
class action_plugin_datapopup extends DokuWiki_Action_Plugin {
var $dthlp = null;
function action_plugin_datapopup() {
$this->dthlp =& plugin_load('helper', 'data');
}
- function register(&$controller) {
+ function register(Doku_Event_Handler $controller) {
global $JSINFO;
$JSINFO['plugin']['datapopup']['registered_types'] = $this->getConf('registered_types');
$controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, 'handle_ajax_call_unknown');
}
protected function _getFields($link, $name) {
if(!$this->dthlp)
return "The datapopup plugin reported an error. Please report.";
$sqlite = $this->dthlp->_getDB();
if(!$sqlite) return "The datapopup had an error retrieving the SQLite plugin. Please report.";
$query = "SELECT data.value FROM data JOIN pages ON data.pid=pages.pid WHERE pages.page='".$link."' AND data.key='".strtolower($name)."';";
$res = $sqlite->query($query);
$rows = $sqlite->res2arr($res);
return $rows[0]['value'];
}
public function handle_ajax_call_unknown(Doku_Event &$event, $param) {
if($event->data != 'plugin_datapopup') return;
global $auth;
global $INPUT;
$link = $INPUT->str('link');
$link = preg_replace('/\?.*/', '', $link);
$fields = explode(',',$this->getConf('fields'));
$fields = array_map('trim',$fields);
$fields = array_filter($fields);
echo '<ul>';
foreach($fields as $name){
$val = $this->_getFields($link, $name);
if($val != "")
{
echo '<li class="dataov_name">';
echo '<div class="li">';
echo hsc($name);
echo '</div></li>';
echo '<li class="dataov_'.hsc($name).'">';
echo '<div class="li">';
echo hsc($val);
echo '</div></li>';
}
}
echo '</ul>';
$event->preventDefault();
$event->stopPropagation();
}
}
// vim:ts=4:sw=4:et:enc=utf-8:
diff --git a/plugin.info.txt b/plugin.info.txt
--- a/plugin.info.txt
+++ b/plugin.info.txt
@@ -1,7 +1,7 @@
base datapopup
author Andreas Boehler
email dev@aboehler.at
-date 2014-09-23
+date 2016-04-21
name datapopup plugin
desc Dynamically displays data entries in a popup
url http://www.aboehler.at
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Dec 24, 5:58 PM (1 d, 14 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
525377
Default Alt Text
(2 KB)
Attached To
rDP datapopup PlugIn
Event Timeline
Log In to Comment