Project

General

Profile

Download (19.2 KB) Statistics
| Branch: | Tag: | Revision:
1 a7f908db Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 a7f908db Scott Ullrich
/*
4 f8ac4407 Phil Davis
	pkg.php
5
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
6
	Copyright (C) 2004-2012 Scott Ullrich <sullrich@gmail.com>
7
	All rights reserved.
8
9
	Redistribution and use in source and binary forms, with or without
10
	modification, are permitted provided that the following conditions are met:
11
12
	1. Redistributions of source code must retain the above copyright notice,
13
	   this list of conditions and the following disclaimer.
14
15
	2. Redistributions in binary form must reproduce the above copyright
16
	   notice, this list of conditions and the following disclaimer in the
17
	   documentation and/or other materials provided with the distribution.
18
19
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
23
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
	POSSIBILITY OF SUCH DAMAGE.
29 a7f908db Scott Ullrich
*/
30 1d333258 Scott Ullrich
/*
31
	pfSense_MODULE:	pkgs
32
*/
33 a7f908db Scott Ullrich
34 6b07c15a Matthew Grooms
##|+PRIV
35
##|*IDENT=page-package-settings
36
##|*NAME=Package: Settings page
37
##|*DESCR=Allow access to the 'Package: Settings' page.
38
##|*MATCH=pkg.php*
39
##|-PRIV
40
41 e4bf1c19 Colin Smith
require_once("guiconfig.inc");
42
require_once("pkg-utils.inc");
43 a7f908db Scott Ullrich
44
function gentitle_pkg($pgname) {
45 e3c4b6b7 Scott Ullrich
	global $config;
46
	return $config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pgname;
47 a7f908db Scott Ullrich
}
48
49 f8ac4407 Phil Davis
function domTT_title($title_msg) {
50 05a42cce Marcello Coutinho
	print "onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\" onmouseover=\"domTT_activate(this, event, 'content', '".gettext($title_msg)."', 'trail', true, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle');\"";
51
}
52
53 98bcf1f8 Scott Ullrich
$xml = $_REQUEST['xml'];
54 a7f908db Scott Ullrich
55 f8ac4407 Phil Davis
if ($xml == "") {
56 ef2029df Scott Ullrich
	print_info_box_np(gettext("ERROR: No package defined."));
57 b000f96f Scott Ullrich
	exit;
58 a7f908db Scott Ullrich
} else {
59 f8ac4407 Phil Davis
	if (file_exists("/usr/local/pkg/" . $xml)) {
60 b000f96f Scott Ullrich
		$pkg = parse_xml_config_pkg("/usr/local/pkg/" . $xml, "packagegui");
61 f8ac4407 Phil Davis
	} else {
62 98bcf1f8 Scott Ullrich
		echo "File not found " . htmlspecialchars($xml);
63
		exit;
64
	}
65 a7f908db Scott Ullrich
}
66
67 f8ac4407 Phil Davis
if ($pkg['donotsave'] <> "") {
68 6f3d2063 Renato Botelho
	header("Location: pkg_edit.php?xml=" . $xml);
69 b000f96f Scott Ullrich
	exit;
70 3eaeb703 Scott Ullrich
}
71
72 7c172009 Scott Ullrich
if ($pkg['include_file'] != "") {
73
	require_once($pkg['include_file']);
74
}
75
76 a28c8b59 Scott Ullrich
$package_name = $pkg['menu'][0]['name'];
77
$section      = $pkg['menu'][0]['section'];
78 a7f908db Scott Ullrich
$config_path  = $pkg['configpath'];
79 7c172009 Scott Ullrich
$title	      = $pkg['title'];
80 e3c4b6b7 Scott Ullrich
81 f8ac4407 Phil Davis
if ($_REQUEST['startdisplayingat']) {
82 32c477c5 Scott Ullrich
	$startdisplayingat = $_REQUEST['startdisplayingat'];
83 f8ac4407 Phil Davis
}
84 32c477c5 Scott Ullrich
85 f8ac4407 Phil Davis
if ($_REQUEST['display_maximum_rows']) {
86
	if ($_REQUEST['display_maximum_rows']) {
87 3ca50a15 Scott Ullrich
		$display_maximum_rows = $_REQUEST['display_maximum_rows'];
88 f8ac4407 Phil Davis
	}
89
}
90 3ca50a15 Scott Ullrich
91 ce696feb Colin Smith
$evaledvar = $config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'];
92 e3c4b6b7 Scott Ullrich
93 05a42cce Marcello Coutinho
if ($_GET['act'] == "update") {
94 f8ac4407 Phil Davis
95
	if (is_array($config['installedpackages'][$pkg['name']]) && $pkg['name'] != "" && $_REQUEST['ids'] !="") {
96
		#get current values
97
		$current_values=$config['installedpackages'][$pkg['name']]['config'];
98
		#get updated ids
99
		parse_str($_REQUEST['ids'], $update_list);
100
		#sort ids to know what to change
101
		#useful to do not lose data when using sorting and paging
102
		$sort_list=$update_list['ids'];
103
		sort($sort_list);
104
		#apply updates
105
		foreach ($update_list['ids'] as $key=> $value) {
106
			$config['installedpackages'][$pkg['name']]['config'][$sort_list[$key]]=$current_values[$update_list['ids'][$key]];
107
		}
108
		#save current config
109
		write_config();
110
		#sync package
111
		eval ("{$pkg['custom_php_resync_config_command']}");
112
	}
113
	#function called via jquery, no need to continue after save changes.
114
	exit;
115 05a42cce Marcello Coutinho
}
116 e3c4b6b7 Scott Ullrich
if ($_GET['act'] == "del") {
117 f8ac4407 Phil Davis
	// loop through our fieldnames and automatically setup the fieldnames
118
	// in the environment.  ie: a fieldname of username with a value of
119
	// testuser would automatically eval $username = "testuser";
120
	foreach ($evaledvar as $ip) {
121
		if ($pkg['adddeleteeditpagefields']['columnitem']) {
122
			foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {
123
				${xml_safe_fieldname($column['fielddescr'])} = $ip[xml_safe_fieldname($column['fieldname'])];
124
			}
125 ef2029df Scott Ullrich
		}
126 f8ac4407 Phil Davis
	}
127 e3c4b6b7 Scott Ullrich
128 f8ac4407 Phil Davis
	$a_pkg = &$config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'];
129 e3c4b6b7 Scott Ullrich
130 f8ac4407 Phil Davis
	if ($a_pkg[$_GET['id']]) {
131
		unset($a_pkg[$_GET['id']]);
132
		write_config();
133
		if ($pkg['custom_delete_php_command'] <> "") {
134
			if ($pkg['custom_php_command_before_form'] <> "") {
135
				eval($pkg['custom_php_command_before_form']);
136 8060d89a Scott Ullrich
			}
137 f8ac4407 Phil Davis
			eval($pkg['custom_delete_php_command']);
138
		}
139
		header("Location:  pkg.php?xml=" . $xml);
140
		exit;
141
	}
142 e3c4b6b7 Scott Ullrich
}
143
144 4b5976b5 Scott Ullrich
ob_start();
145
146 d3ab36dc Ermal Lu?i
$iflist = get_configured_interface_with_descr(false, true);
147 ce696feb Colin Smith
$evaledvar = $config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'];
148 a7f908db Scott Ullrich
149 f8ac4407 Phil Davis
if ($pkg['custom_php_global_functions'] <> "") {
150 ef2029df Scott Ullrich
	eval($pkg['custom_php_global_functions']);
151 f8ac4407 Phil Davis
}
152 194b4e0a Colin Smith
153 f8ac4407 Phil Davis
if ($pkg['custom_php_command_before_form'] <> "") {
154 194b4e0a Colin Smith
	eval($pkg['custom_php_command_before_form']);
155 f8ac4407 Phil Davis
}
156 f9a91638 Scott Ullrich
157 d88c6a9f Scott Ullrich
$pgtitle = array($title);
158 83ddedcd Scott Ullrich
include("head.inc");
159
160 a7f908db Scott Ullrich
?>
161
162
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
163 44507df4 Colin Fleming
<?php include("fbegin.inc"); ?>
164
<script type="text/javascript" src="javascript/domTT/domLib.js"></script>
165
<script type="text/javascript" src="javascript/domTT/domTT.js"></script>
166
<script type="text/javascript" src="javascript/domTT/behaviour.js"></script>
167
<script type="text/javascript" src="javascript/domTT/fadomatic.js"></script>
168
<script type="text/javascript">
169
//<![CDATA[
170
	function setFilter(filtertext) {
171
		jQuery('#pkg_filter').val(filtertext);
172
		document.pkgform.submit();
173 f8ac4407 Phil Davis
	}
174 44507df4 Colin Fleming
175
	<?php
176 f8ac4407 Phil Davis
		if ($pkg['adddeleteeditpagefields']['movable']) {
177 44507df4 Colin Fleming
	?>
178 f8ac4407 Phil Davis
			jQuery(document).ready(function() {
179 44507df4 Colin Fleming
				jQuery('#mainarea table tbody').sortable({
180
					items: 'tr.sortable',
181
					cursor: 'move',
182
					distance: 10,
183
					opacity: 0.8,
184 6c07db48 Phil Davis
					helper: function(e, ui) {
185 f8ac4407 Phil Davis
						ui.children().each(function() {
186
							jQuery(this).width(jQuery(this).width());
187 44507df4 Colin Fleming
						});
188 f8ac4407 Phil Davis
					return ui;
189 44507df4 Colin Fleming
					},
190
				});
191
			});
192
			function save_changes_to_xml(xml) {
193 6c07db48 Phil Davis
				var ids=jQuery('#mainarea table tbody').sortable('serialize', {key:"ids[]"});
194
				var strloading="<img src='/themes/<?= $g['theme']; ?>/images/misc/loader.gif' alt='loader' /> " + "<?=gettext('Saving changes...');?>";
195 f8ac4407 Phil Davis
				if (confirm("<?=gettext("Do you really want to save changes?");?>")) {
196
					jQuery.ajax({
197
						type: 'get',
198
						cache: false,
199
						url: "<?=$_SERVER['SCRIPT_NAME'];?>",
200
						data: {xml:'<?=$xml?>', act:'update', ids: ids},
201
						beforeSend: function() {
202
							jQuery('#savemsg').empty().html(strloading);
203
						},
204
						error: function(data) {
205
							jQuery('#savemsg').empty().html('Error:' + data);
206
						},
207
						success: function(data) {
208
							jQuery('#savemsg').empty().html(data);
209
						}
210
					});
211
				}
212 44507df4 Colin Fleming
			}
213 f8ac4407 Phil Davis
	<?php
214 44507df4 Colin Fleming
		}
215
	?>
216
//]]>
217
</script>
218 5aa9a4f2 Scott Ullrich
<form action="pkg.php" name="pkgform" method="get">
219 44507df4 Colin Fleming
<input type='hidden' name='xml' value='<?=$_REQUEST['xml']?>' />
220 f8ac4407 Phil Davis
<?php if ($_GET['savemsg'] <> "") $savemsg = htmlspecialchars($_GET['savemsg']); ?>
221 05a42cce Marcello Coutinho
<div id="savemsg"></div>
222 a7f908db Scott Ullrich
<?php if ($savemsg) print_info_box($savemsg); ?>
223 44507df4 Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="package settings">
224 7c061036 Scott Ullrich
<?php
225 f8ac4407 Phil Davis
	if ($pkg['tabs'] <> "") {
226
		$tab_array = array();
227
		foreach ($pkg['tabs']['tab'] as $tab) {
228
			if ($tab['tab_level']) {
229
				$tab_level = $tab['tab_level'];
230
			} else {
231
				$tab_level = 1;
232
			}
233
			if (isset($tab['active'])) {
234
				$active = true;
235
			} else {
236
				$active = false;
237
			}
238
			if (isset($tab['no_drop_down'])) {
239
				$no_drop_down = true;
240
			}
241
			$urltmp = "";
242
			if ($tab['url'] <> "") {
243
				$urltmp = $tab['url'];
244
			}
245
			if ($tab['xml'] <> "") {
246
				$urltmp = "pkg_edit.php?xml=" . $tab['xml'];
247
			}
248
249
			$addresswithport = getenv("HTTP_HOST");
250
			$colonpos = strpos($addresswithport, ":");
251
			if ($colonpos !== False) {
252
				//my url is actually just the IP address of the pfsense box
253
				$myurl = substr($addresswithport, 0, $colonpos);
254
			} else {
255
				$myurl = $addresswithport;
256
			}
257
			// eval url so that above $myurl item can be processed if need be.
258
			$url = str_replace('$myurl', $myurl, $urltmp);
259
260
			$tab_array[$tab_level][] = array(
261
				$tab['text'],
262
				$active,
263
				$url
264
			);
265
		}
266
267
		ksort($tab_array);
268
		foreach ($tab_array as $tab) {
269
			echo '<tr><td>';
270
			display_top_tabs($tab, $no_drop_down);
271
			echo '</td></tr>';
272
		}
273
	}
274 7c061036 Scott Ullrich
?>
275 44507df4 Colin Fleming
<tr><td><div id="mainarea"><table width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
276 32c477c5 Scott Ullrich
	<tr>
277
		<td class="tabcont">
278 44507df4 Colin Fleming
			<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabs">
279 32c477c5 Scott Ullrich
<?php
280 f8ac4407 Phil Davis
	/* Handle filtering bar A-Z */
281
	$include_filtering_inputbox = false;
282
	$colspan = 0;
283
	if ($pkg['adddeleteeditpagefields']['columnitem'] <> "") {
284
		foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {
285
			$colspan++;
286
		}
287
	}
288
	if ($pkg['fields']['field']) {
289
		// First find the sorting type field if it exists
290
		foreach ($pkg['fields']['field'] as $field) {
291
			if ($field['type'] == "sorting") {
292
				if (isset($field['include_filtering_inputbox'])) {
293
					$include_filtering_inputbox = true;
294
				}
295
				if ($display_maximum_rows < 1) {
296
					if ($field['display_maximum_rows']) {
297
						$display_maximum_rows = $field['display_maximum_rows'];
298
					}
299
				}
300
				echo "<tr><td class='listhdrr' colspan='$colspan' align='center'>";
301
				echo "Filter by: ";
302
				$isfirst = true;
303
				for ($char = 65; $char < 91; $char++) {
304
					if (!$isfirst) {
305
						echo " | ";
306
					}
307
					echo "<a href=\"#\" onclick=\"setFilter('" . chr($char) . "');\">" . chr($char) . "</a>";
308
					$isfirst = false;
309
				}
310
				echo "</td></tr>";
311
				echo "<tr><td class='listhdrr' colspan='$colspan' align='center'>";
312
				if ($field['sortablefields']) {
313
					echo "Filter field: <select name='pkg_filter_type'>";
314
					foreach ($field['sortablefields']['item'] as $si) {
315
						if ($si['name'] == $_REQUEST['pkg_filter_type']) {
316
							$SELECTED = "selected=\"selected\"";
317
						} else {
318
							$SELECTED = "";
319 32c477c5 Scott Ullrich
						}
320 f8ac4407 Phil Davis
						echo "<option value='{$si['name']}' {$SELECTED}>{$si['name']}</option>";
321 32c477c5 Scott Ullrich
					}
322 f8ac4407 Phil Davis
					echo "</select>";
323 32c477c5 Scott Ullrich
				}
324 f8ac4407 Phil Davis
				if ($include_filtering_inputbox) {
325
					echo "&nbsp;&nbsp;Filter text: <input id='pkg_filter' name='pkg_filter' value='" . $_REQUEST['pkg_filter'] . "' /> <input type='submit' value='Filter' />";
326
				}
327
				echo "</td></tr><tr><td><font size='-3'>&nbsp;</font></td></tr>";
328
			}
329
		}
330
	}
331 32c477c5 Scott Ullrich
?>
332
				<tr>
333
<?php
334 f8ac4407 Phil Davis
	if ($display_maximum_rows) {
335 6c07db48 Phil Davis
		$totalpages = ceil(round((count($evaledvar) / $display_maximum_rows), 9));
336 f8ac4407 Phil Davis
		$page = 1;
337
		$tmpcount = 0;
338
		$tmppp = 0;
339
		if (is_array($evaledvar)) {
340
			foreach ($evaledvar as $ipa) {
341
				if ($tmpcount == $display_maximum_rows) {
342
					$page++;
343 37da0c50 Scott Ullrich
					$tmpcount = 0;
344
				}
345 f8ac4407 Phil Davis
				if ($tmppp == $startdisplayingat) {
346
					break;
347 32c477c5 Scott Ullrich
				}
348 f8ac4407 Phil Davis
				$tmpcount++;
349
				$tmppp++;
350
			}
351
		}
352
		echo "<tr><td colspan='" . count($pkg['adddeleteeditpagefields']['columnitem']) . "'>";
353
		echo "<table width='100%' summary=''>";
354
		echo "<tr>";
355
		echo "<td align='left'>Displaying page $page of $totalpages</b></td>";
356
		echo "<td align='right'>Rows per page: <select onchange='document.pkgform.submit();' name='display_maximum_rows'>";
357 6c07db48 Phil Davis
		for ($x = 0; $x < 250; $x++) {
358 f8ac4407 Phil Davis
			if ($x == $display_maximum_rows) {
359
				$SELECTED = "selected=\"selected\"";
360
			} else {
361
				$SELECTED = "";
362
			}
363
			echo "<option value='$x' $SELECTED>$x</option>\n";
364
			$x = $x + 4;
365
		}
366
		echo "</select></td></tr>";
367
		echo "</table>";
368
		echo "</td></tr>";
369
	}
370
	$cols = 0;
371
	if ($pkg['adddeleteeditpagefields']['columnitem'] <> "") {
372
		foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {
373
			echo "<td class=\"listhdrr\">" . $column['fielddescr'] . "</td>";
374
			$cols++;
375
		}
376
	}
377
?>
378
				</tr>
379
<?php
380
	$i = 0;
381 6c07db48 Phil Davis
	$pagination_startingrow = 0;
382
	$pagination_counter = 0;
383 f8ac4407 Phil Davis
	if ($evaledvar) {
384
		foreach ($evaledvar as $ip) {
385
			if ($startdisplayingat) {
386
				if ($i < $startdisplayingat) {
387
					$i++;
388
					continue;
389 32c477c5 Scott Ullrich
				}
390 f8ac4407 Phil Davis
			}
391
			if ($_REQUEST['pkg_filter']) {
392
				// Handle filtered items
393
				if ($pkg['fields']['field'] && !$filter_regex) {
394
					// First find the sorting type field if it exists
395
					foreach ($pkg['fields']['field'] as $field) {
396
						if ($field['type'] == "sorting") {
397
							if ($field['sortablefields']['item']) {
398
								foreach ($field['sortablefields']['item'] as $sf) {
399
									if ($sf['name'] == $_REQUEST['pkg_filter_type']) {
400
										$filter_fieldname = $sf['fieldname'];
401
										#Use a default regex on sortable fields when none is declared
402
										if ($sf['regex']) {
403
											$filter_regex = str_replace("%FILTERTEXT%", $_REQUEST['pkg_filter'], trim($sf['regex']));
404
										} else {
405
											$filter_regex = "/{$_REQUEST['pkg_filter']}/i";
406 32c477c5 Scott Ullrich
										}
407
									}
408
								}
409
							}
410
						}
411
					}
412 f8ac4407 Phil Davis
				}
413
				// Do we have something to filter on?
414
				unset($filter_matches);
415
				if ($pkg['adddeleteeditpagefields']['columnitem'] <> "") {
416
					foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {
417
						$fieldname = $ip[xml_safe_fieldname($column['fieldname'])];
418
						if ($column['fieldname'] == $filter_fieldname) {
419
							if ($filter_regex) {
420
								//echo "$filter_regex - $fieldname<p/>";
421
								preg_match($filter_regex, $fieldname, $filter_matches);
422
								break;
423 32c477c5 Scott Ullrich
							}
424
						}
425
					}
426
				}
427 f8ac4407 Phil Davis
				if (!$filter_matches) {
428
					$i++;
429
					continue;
430
				}
431
			}
432
			if ($pkg['adddeleteeditpagefields']['movable']) {
433
				echo "<tr valign=\"top\" class=\"sortable\" id=\"id_{$i}\">\n";
434
			} else {
435
				echo "<tr valign=\"top\">\n";
436
			}
437
			if ($pkg['adddeleteeditpagefields']['columnitem'] <> "") {
438
				foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {
439
					if ($column['fieldname'] == "description") {
440
						$class = "listbg";
441
					} else {
442
						$class = "listlr";
443
					}
444 32c477c5 Scott Ullrich
?>
445 f8ac4407 Phil Davis
					<td class="<?=$class;?>" ondblclick="document.location='pkg_edit.php?xml=<?=$xml?>&amp;act=edit&amp;id=<?=$i;?>';">
446 32c477c5 Scott Ullrich
<?php
447 f8ac4407 Phil Davis
					$fieldname = $ip[xml_safe_fieldname($column['fieldname'])];
448
					#Check if columnitem has a type field declared
449
					if ($column['type'] == "checkbox") {
450
						if ($fieldname == "") {
451
							echo gettext("No");
452
						} else {
453
							echo gettext("Yes");
454
						}
455
					} else if ($column['type'] == "interface") {
456 6c07db48 Phil Davis
						echo $column['prefix'] . $iflist[$fieldname] . $column['suffix'];
457 f8ac4407 Phil Davis
					} else {
458
						#Check if columnitem has an encoding field declared
459
						if ($column['encoding'] == "base64") {
460 6c07db48 Phil Davis
							echo $column['prefix'] . base64_decode($fieldname) . $column['suffix'];
461 f8ac4407 Phil Davis
						#Check if there is a custom info to show when $fieldname is not empty
462
						} else if ($column['listmodeon'] && $fieldname != "") {
463
							echo $column['prefix'] . gettext($column['listmodeon']). $column['suffix'];
464
						#Check if there is a custom info to show when $fieldname is empty
465
						} else if ($column['listmodeoff'] && $fieldname == "") {
466
							echo $column['prefix'] .gettext($column['listmodeoff']). $column['suffix'];
467
						} else {
468
							echo $column['prefix'] . $fieldname ." ". $column['suffix'];
469
						}
470 32c477c5 Scott Ullrich
					}
471
?>
472 f8ac4407 Phil Davis
					</td>
473 32c477c5 Scott Ullrich
<?php
474 f8ac4407 Phil Davis
				} // foreach columnitem
475
			} // if columnitem
476
?>
477
					<td valign="middle" class="list nowrap">
478
						<table border="0" cellspacing="0" cellpadding="1" summary="icons">
479
							<tr>
480
<?php
481
			#Show custom description to edit button if defined
482
			$edit_msg=($pkg['adddeleteeditpagefields']['edittext']?$pkg['adddeleteeditpagefields']['edittext']:"Edit this item");
483
?>
484
								<td valign="middle"><a href="pkg_edit.php?xml=<?=$xml?>&amp;act=edit&amp;id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" <?=domTT_title($edit_msg)?> alt="edit" /></a></td>
485
<?php
486
			#Show custom description to delete button if defined
487
			$delete_msg=($pkg['adddeleteeditpagefields']['deletetext']?$pkg['adddeleteeditpagefields']['deletetext']:"Delete this item");
488
?>
489
								<td valign="middle"><a href="pkg.php?xml=<?=$xml?>&amp;act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this item?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" <?=domTT_title($delete_msg)?> alt="delete" /></a></td>
490
							</tr>
491
						</table>
492
					</td>
493
<?php
494
			echo "</tr>\n"; // Pairs with an echo tr some way above 
495
			// Handle pagination and display_maximum_rows
496
			if ($display_maximum_rows) {
497
				if ($pagination_counter == ($display_maximum_rows-1) or
498
				    $i == (count($evaledvar)-1)) {
499
					$colcount = count($pkg['adddeleteeditpagefields']['columnitem']);
500
					$final_footer = "";
501
					$final_footer .= "<tr><td colspan='$colcount'>";
502 6c07db48 Phil Davis
					$final_footer .= "<table width='100%' summary=''><tr>";
503
					$final_footer .= "<td align='left'>";
504 f8ac4407 Phil Davis
					$startingat = $startdisplayingat - $display_maximum_rows;
505
					if ($startingat > -1) {
506 6c07db48 Phil Davis
						$final_footer .= "<a href='pkg.php?xml=" . $_REQUEST['xml'] . "&amp;startdisplayingat={$startingat}&amp;display_maximum_rows={$display_maximum_rows}'>";
507 f8ac4407 Phil Davis
					} else if ($startdisplayingat > 1) {
508 6c07db48 Phil Davis
						$final_footer .= "<a href='pkg.php?xml=" . $_REQUEST['xml'] . "&amp;startdisplayingat=0&amp;display_maximum_rows={$display_maximum_rows}'>";
509 32c477c5 Scott Ullrich
					}
510 6c07db48 Phil Davis
					$final_footer .= "<font size='2'><< Previous page</font></a>";
511 f8ac4407 Phil Davis
					if ($tmppp + $display_maximum_rows > count($evaledvar)) {
512
						$endingrecord = count($evaledvar);
513
					} else {
514
						$endingrecord = $tmppp + $display_maximum_rows;
515
					}
516 6c07db48 Phil Davis
					$final_footer .= "</td><td align='center'>";
517 f8ac4407 Phil Davis
					$tmppp++;
518 6c07db48 Phil Davis
					$final_footer .= "<font size='2'>Displaying {$tmppp} - {$endingrecord} / " . count($evaledvar) . " records";
519
					$final_footer .= "</font></td><td align='right'>&nbsp;";
520 f8ac4407 Phil Davis
					if (($i+1) < count($evaledvar)) {
521 6c07db48 Phil Davis
						$final_footer .= "<a href='pkg.php?xml=" . $_REQUEST['xml'] . "&amp;startdisplayingat=" . ($startdisplayingat + $display_maximum_rows) . "&amp;display_maximum_rows={$display_maximum_rows}'>";
522 f8ac4407 Phil Davis
					}
523 6c07db48 Phil Davis
					$final_footer .= "<font size='2'>Next page >></font></a>";
524
					$final_footer .= "</td></tr></table></td></tr>";
525 f8ac4407 Phil Davis
					$i = count($evaledvar);
526
					break;
527 549912e3 Scott Ullrich
				}
528 f8ac4407 Phil Davis
			}
529
			$i++;
530
			$pagination_counter++;
531
		} // foreach evaledvar
532
	} // if evaledvar
533 32c477c5 Scott Ullrich
?>
534
				<tr>
535
					<td colspan="<?=$cols?>"></td>
536
					<td>
537 44507df4 Colin Fleming
						<table border="0" cellspacing="0" cellpadding="1" summary="icons">
538 32c477c5 Scott Ullrich
							<tr>
539 f8ac4407 Phil Davis
<?php
540
	#Show custom description to add button if defined
541
	$add_msg=($pkg['adddeleteeditpagefields']['addtext']?$pkg['adddeleteeditpagefields']['addtext']:"Add a new item");
542
?>
543 44507df4 Colin Fleming
								<td valign="middle"><a href="pkg_edit.php?xml=<?=$xml?>&amp;id=<?=$i?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" <?=domTT_title($add_msg)?> alt="add" /></a></td>
544 f8ac4407 Phil Davis
<?php
545
	#Show description button and info if defined
546
	if ($pkg['adddeleteeditpagefields']['description']) {
547
?>
548 44507df4 Colin Fleming
								<td valign="middle"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_info_pkg.gif" width="17" height="17" border="0" <?=domTT_title($pkg['adddeleteeditpagefields']['description'])?> alt="info" /></td>
549 f8ac4407 Phil Davis
<?php
550
	}
551
?>
552 32c477c5 Scott Ullrich
							</tr>
553
						</table>
554
					</td>
555
				</tr>
556 37da0c50 Scott Ullrich
				<?=$final_footer?>
557 f8ac4407 Phil Davis
<?php
558
	#Show save button only when movable is defined
559
	if ($pkg['adddeleteeditpagefields']['movable']) {
560
?>
561
				<tr>
562
					<td><input class="formbtn" type="button" value="Save" name="Submit" onclick="save_changes_to_xml('<?=$xml?>')" /></td>
563
				</tr>
564
<?php
565
	}
566
?>
567
			</table>
568
		</td>
569
	</tr>
570
</table></div></td></tr>
571 a7f908db Scott Ullrich
</table>
572 3d335c4d Scott Ullrich
573 a7f908db Scott Ullrich
</form>
574
<?php include("fend.inc"); ?>
575 323d040b Scott Ullrich
576 b000f96f Scott Ullrich
<?php
577
	echo "<!-- filter_fieldname: {$filter_fieldname} -->";
578
	echo "<!-- filter_regex: {$filter_regex} -->";
579
?>
580
581 a7f908db Scott Ullrich
</body>
582
</html>