<commit_before><?php
// (c) Copyright 2002-2010 by authors of the Tiki Wiki/CMS/Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

function wikiplugin_trackerfilter_help() {
  $help = tra("Filters the items of a tracker, fields are indicated with numeric ids.").":\n";
  $help .= "~np~{TRACKERFILTER(filters=>2/d:4/r:5,action=>Name of submit button,displayList=y|n,line=y|n,TRACKERLIST_params )}Notice{TRACKERFILTER}~/np~";
  return $help;
}

function wikiplugin_trackerfilter_info() {
	require_once 'lib/wiki-plugins/wikiplugin_trackerlist.php';
	$list = wikiplugin_trackerlist_info();
	$params = array_merge( array(
		'filters' => array(
			'required' => true,
			'name' => tra('Filters'),
			'description' => tra('Example:') . '2/d:4/r:5:(6:7)/sqlsearch',
		),
		'action' => array(
			'required' => false,
			'name' => tra('Action'),
			'description' => tra('Label on the submit button. Default: "Filter". Use a space character to omit the button (for use in datachannels etc)'),
		),
		'displayList' => array(
			'required' => false,
			'name' => tra('Display List'),
			'description' => 'y|n - ' . tra('Show the full list initially'),
		),
		'line' => array(
			'required' => false,
			'name' => tra('Line'),
			'description' => 'y|n - ' . tra('Displays all the filter on the same line'),
		),
		'noflipflop' => array(
			'required' => false,
			'name' => tra("Don't show filters switch"),
			'description' => 'y|n - ' . tra('Always displays the window without flip flop'),
		),
		'export_action' => array(
			'required' => false,
			'name' => tra('Export CSV.'),
			'description' => 'Label for an export button. Leave blank to show the usual "Filter" button instead.',
			'advanced' => true,
		),
		'googlemapButtons' => array(
			'required' => false,
			'name' => tra('Google Map Buttons'),
			'description' => 'y|n - Display Mapview and Listview buttons',
		),
	), $list['params'] );

return array(
		'name' => tra('Tracker Filter'),
		'documentation' => 'PluginTrackerFilter',
		'description' => tra("Filters the items of a tracker, fields are indicated with numeric ids."),
		'prefs' => array( 'feature_trackers', 'wikiplugin_trackerfilter' ),
		'body' => tra('notice'),
		'params' => $params,
		'extraparams' => true,
);
}

function wikiplugin_trackerfilter($data, $params) {
	global $smarty, $prefs;
	global $trklib;	include_once('lib/trackers/trackerlib.php');
	static $iTrackerFilter = 0;
	if ($prefs['feature_trackers'] != 'y') {
		return $smarty->fetch("wiki-plugins/error_tracker.tpl");
	}
	$default = array('noflipflop'=>'n', 'action'=>'Filter', 'line' => 'n', 'displayList' => 'n', 'export_action' => '',
					 'export_itemid' => 'y', 'export_status' => 'n', 'export_created' => 'n', 'export_modif' => 'n', 'export_charset' => 'UTF-8', 'status' => 'opc');
	
	if (isset($_REQUEST["mapview"]) && $_REQUEST["mapview"] == 'y' && !isset($_REQUEST["searchmap"]) && !isset($_REQUEST["searchlist"]) || isset($_REQUEST["searchmap"]) && !isset($_REQUEST["searchlist"])) {
		$params["googlemap"] = 'y';
	}
	if (isset($_REQUEST["mapview"]) && $_REQUEST["mapview"] == 'n' && !isset($_REQUEST["searchmap"]) && !isset($_REQUEST["searchlist"]) || isset($_REQUEST["searchlist"]) && !isset($_REQUEST["searchmap"]) ) {
		$params["googlemap"] = 'n';
	}
	$params = array_merge($default, $params);
	extract($params, EXTR_SKIP);
	$dataRes = '';
	$iTrackerFilter++;

	if (isset($_REQUEST['msgTrackerFilter'])) {
		$smarty->assign('msgTrackerFilter', $_REQUEST['msgTrackerFilter']);
	}<commit_msg>Add options, default fields and other cleanup to plugin info for use in plugin edit popup and plugin manager<commit_after><?php
// (c) Copyright 2002-2010 by authors of the Tiki Wiki/CMS/Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

function wikiplugin_trackerfilter_help() {
  $help = tra("Filters the items of a tracker, fields are indicated with numeric ids.").":\n";
  $help .= "~np~{TRACKERFILTER(filters=>2/d:4/r:5,action=>Name of submit button,displayList=y|n,line=y|n,TRACKERLIST_params )}Notice{TRACKERFILTER}~/np~";
  return $help;
}

function wikiplugin_trackerfilter_info() {
	require_once 'lib/wiki-plugins/wikiplugin_trackerlist.php';
	$list = wikiplugin_trackerlist_info();
	$params = array_merge( array(
		'filters' => array(
			'required' => true,
			'name' => tra('Filters'),
			'description' => tra('The list of fields that can be used as filters along with their formats. The field number and format are separated by a / 
								 and multile fields are separated by ":". Format choices are: d - dropdown; r - radio buttons; m - multiple choice dropdown;
								 c - checkbox; t - text with wild characters; T - exact text match; i - initials; sqlsearch - advanced search; >, <, >=, <= -
								 greater than, less than, greater than or equal, less than or equal. Example:') . '2/d:4/r:5:(6:7)/sqlsearch',
			'default' => ''
		),
		'action' => array(
			'required' => false,
			'name' => tra('Action'),
			'description' => tra('Label on the submit button. Default: "Filter". Use a space character to omit the button (for use in datachannels etc)'),
			'default' => 'Filter'
		),
		'displayList' => array(
			'required' => false,
			'name' => tra('Display List'),
			'description' => tra('Show the full list (before filtering) initially (filtered list shown by default)'),
			'filter' => 'alpha',
			'default' => 'n',
			'options' => array(
				array('text' => '', 'value' => ''), 
				array('text' => tra('Yes'), 'value' => 'y'), 
				array('text' => tra('No'), 'value' => 'n')
			)
		),
		'line' => array(
			'required' => false,
			'name' => tra('Line'),
			'description' => tra('Displays all the filters on the same line (not shown on same line by default)'),
			'filter' => 'alpha',
			'default' => 'n',
			'options' => array(
				array('text' => '', 'value' => ''), 
				array('text' => tra('Yes'), 'value' => 'y'), 
				array('text' => tra('No'), 'value' => 'n')
			)
		),
		'noflipflop' => array(
			'required' => false,
			'name' => tra('No Toggle'),
			'description' => tra('The toggle button to show/hide filters will not be shown if set to y (Yes). Default is to show the toggle.'),
			'filter' => 'alpha',
			'default' => 'n',
			'options' => array(
				array('text' => '', 'value' => ''), 
				array('text' => tra('Yes'), 'value' => 'y'), 
				array('text' => tra('No'), 'value' => 'n')
			)
		),
		'export_action' => array(
			'required' => false,
			'name' => tra('Export CSV.'),
			'description' => tra('Label for an export button. Leave blank to show the usual "Filter" button instead.'),
			'default' => '',
			'advanced' => true,
		),
		'googlemapButtons' => array(
			'required' => false,
			'name' => tra('Google Map Buttons'),
			'description' => tra('Display Mapview and Listview buttons'),
			'filter' => 'alpha',
			'default' => '',
			'options' => array(
				array('text' => '', 'value' => ''), 
				array('text' => tra('Yes'), 'value' => 'y'), 
				array('text' => tra('No'), 'value' => 'n')
			)
		)
	), $list['params'] );

return array(
		'name' => tra('Tracker Filter'),
		'documentation' => tra('PluginTrackerFilter'),
		'description' => tra('Filters the items of a tracker, fields are indicated with numeric ids.'),
		'prefs' => array( 'feature_trackers', 'wikiplugin_trackerfilter' ),
		'body' => tra('notice'),
		'params' => $params,
		'extraparams' => true,
);
}

function wikiplugin_trackerfilter($data, $params) {
	global $smarty, $prefs;
	global $trklib;	include_once('lib/trackers/trackerlib.php');
	static $iTrackerFilter = 0;
	if ($prefs['feature_trackers'] != 'y') {
		return $smarty->fetch("wiki-plugins/error_tracker.tpl");
	}
	$default = array('noflipflop'=>'n', 'action'=>'Filter', 'line' => 'n', 'displayList' => 'n', 'export_action' => '',
					 'export_itemid' => 'y', 'export_status' => 'n', 'export_created' => 'n', 'export_modif' => 'n', 'export_charset' => 'UTF-8', 'status' => 'opc');
	
	if (isset($_REQUEST["mapview"]) && $_REQUEST["mapview"] == 'y' && !isset($_REQUEST["searchmap"]) && !isset($_REQUEST["searchlist"]) || isset($_REQUEST["searchmap"]) && !isset($_REQUEST["searchlist"])) {
		$params["googlemap"] = 'y';
	}
	if (isset($_REQUEST["mapview"]) && $_REQUEST["mapview"] == 'n' && !isset($_REQUEST["searchmap"]) && !isset($_REQUEST["searchlist"]) || isset($_REQUEST["searchlist"]) && !isset($_REQUEST["searchmap"]) ) {
		$params["googlemap"] = 'n';
	}
	$params = array_merge($default, $params);
	extract($params, EXTR_SKIP);
	$dataRes = '';
	$iTrackerFilter++;

	if (isset($_REQUEST['msgTrackerFilter'])) {
		$smarty->assign('msgTrackerFilter', $_REQUEST['msgTrackerFilter']);
	}
{'fraction_non_alphanumeric': 0.2056401579244219, 'fraction_numerical': 0.0040609137055837565, 'mean_word_length': 4.5, 'pattern_counts': {'":': 3, '<': 7, '<?xml version=': 0, '>': 146, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '968753', 'n_tokens_mistral': 3219, 'n_tokens_neox': 2952, 'n_words': 758}