summaryrefslogtreecommitdiff
path: root/plugins/data.dropdown.php
blob: 4c1eee689704deb8a8972df0da08f5848e114f4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php

namespace Bitweaver\Liberty;

use Bitweaver\KernelTools;

/**
 * @version  $Revision$
 * @package  liberty
 * @subpackage plugins_data
 */
// +----------------------------------------------------------------------+
// | Copyright (c) 2004, bitweaver.org
// +----------------------------------------------------------------------+
// | All Rights Reserved. See below for details and a complete list of authors.
// | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
// |
// | For comments, please use phpdocu.sourceforge.net documentation standards!!!
// | -> see http://phpdocu.sourceforge.net/
// +----------------------------------------------------------------------+
// | Author: StarRider starrrider@sourceforge.net
// +----------------------------------------------------------------------+
// $id: data.dropdown.php,v 1.8 2005/07/14 09:03:36 starrider Exp $

/**
 * Initialization
 */
global $gLibertySystem;
define( 'PLUGIN_GUID_DATADROPDOWN', 'datadropdown' );
$pluginParams = [
	'tag' => 'DD',
	'auto_activate' => false,
	'requires_pair' => true,
	'load_function' => '\data_dropdown',
	'title' => 'DropDown',
	'help_page' => 'DataPluginDropDown',
	'description' => KernelTools::tra("This plugin creates a expandable box of text. All text should be entered between the ") . "{DD} " . KernelTools::tra("blocks."),
	'help_function' => '\data_dropdown_help',
	'syntax' => "{DD title= width= }" . KernelTools::tra("Text in the Drop-Down box.") . "{DD}",
	'plugin_type' => DATA_PLUGIN,
];
$gLibertySystem->registerPlugin( PLUGIN_GUID_DATADROPDOWN, $pluginParams );
$gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATADROPDOWN );

/**
 * Help Function
 */
function data_dropdown_help() {
	$help =
		'<table class="data help">'
			.'<tr>'
				.'<th>' . KernelTools::tra( "Key" ) . '</th>'
				.'<th>' . KernelTools::tra( "Type" ) . '</th>'
				.'<th>' . KernelTools::tra( "Comments" ) . '</th>'
			.'</tr>'
			.'<tr class="odd">'
				.'<td>title</td>'
				.'<td>' . KernelTools::tra( "string") . '<br />' . KernelTools::tra("(optional)") . '</td>'
				.'<td>' . KernelTools::tra( 'String used as the link to Expand / Contract the text box. <br />The Default = <strong>"For More Information"</strong></td>')
			.'</tr>'
			.'<tr class="even">'
				.'<td>width</td>'
				.'<td>' . KernelTools::tra( "numeric") . '<br />' . KernelTools::tra("(optional)") . '</td>'
				.'<td>' . KernelTools::tra( "Controls the width of the title area in pixels. This is a percentage value but the % character should not be added.<br />The Default = ") . '<strong>20</strong></td>'
			.'</tr>'
		.'</table>'
		. KernelTools::tra("Example: ") . '{DD}' . KernelTools::tra("Text in the Drop-Down box.") . '{DD}<br />'
		. KernelTools::tra("Example: ") . "{DD title='" . KernelTools::tra("Explaining the Lines #1 #3 &amp; #7'} Text in the Drop-Down box") . '{DD}';
	return $help;
}

/**
* Load Function
*/
function data_dropdown($data, $params) {
	extract ($params, EXTR_SKIP);
	$title = $title ?? KernelTools::tra( 'For More Information, click me.' );
	$id = 'dropdown'.(microtime() * 1000000);
	$ret = 	'<div style="text-align:center;font-weight:bold;">'
				.'<a title="Click to Expand or Contract" href="javascript:flip(\''.$id.'\')">'.$title.'</a>'
			.'</div>'
			.'<div class="help box" style="display:none" id="'.$id.'">'.$data.'</div>';
	return $ret;
}