Project

General

Profile

Download (19.5 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
	pkg.php
4
/*
5
/* ====================================================================
6
 *	Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved.
7
 *
8
 *	Redistribution and use in source and binary forms, with or without modification,
9
 *	are permitted provided that the following conditions are met:
10
 *
11
 *	1. Redistributions of source code must retain the above copyright notice,
12
 *		this list of conditions and the following disclaimer.
13
 *
14
 *	2. Redistributions in binary form must reproduce the above copyright
15
 *		notice, this list of conditions and the following disclaimer in
16
 *		the documentation and/or other materials provided with the
17
 *		distribution.
18
 *
19
 *	3. All advertising materials mentioning features or use of this software
20
 *		must display the following acknowledgment:
21
 *		"This product includes software developed by the pfSense Project
22
 *		 for use in the pfSense software distribution. (http://www.pfsense.org/).
23
 *
24
 *	4. The names "pfSense" and "pfSense Project" must not be used to
25
 *		 endorse or promote products derived from this software without
26
 *		 prior written permission. For written permission, please contact
27
 *		 coreteam@pfsense.org.
28
 *
29
 *	5. Products derived from this software may not be called "pfSense"
30
 *		nor may "pfSense" appear in their names without prior written
31
 *		permission of the Electric Sheep Fencing, LLC.
32
 *
33
 *	6. Redistributions of any form whatsoever must retain the following
34
 *		acknowledgment:
35
 *
36
 *	"This product includes software developed by the pfSense Project
37
 *	for use in the pfSense software distribution (http://www.pfsense.org/).
38
 *
39
 *	THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
40
 *	EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41
 *	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42
 *	PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
43
 *	ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44
 *	SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45
 *	NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46
 *	LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47
 *	HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48
 *	STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49
 *	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50
 *	OF THE POSSIBILITY OF SUCH DAMAGE.
51
 *
52
 *	====================================================================
53
 *
54
 */
55

    
56
##|+PRIV
57
##|*IDENT=page-package-settings
58
##|*NAME=Package: Settings
59
##|*DESCR=Allow access to the 'Package: Settings' page.
60
##|*MATCH=pkg.php*
61
##|-PRIV
62

    
63
require_once("guiconfig.inc");
64
require_once("pkg-utils.inc");
65

    
66
function gentitle_pkg($pgname) {
67
	global $config;
68
	return $config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pgname;
69
}
70

    
71
function domTT_title($title_msg) {
72
	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');\"";
73
}
74

    
75
$xml = $_REQUEST['xml'];
76

    
77
if ($xml == "") {
78
	include("head.inc");
79
	print_info_box_np(gettext("ERROR: No valid package defined."));
80
	include("foot.inc");
81
	exit;
82
} else {
83
	$pkg_xml_prefix = "/usr/local/pkg/";
84
	$pkg_full_path = "{$pkg_xml_prefix}/{$xml}";
85
	if (substr_compare(realpath($pkg_full_path), $pkg_xml_prefix, 0, strlen($pkg_xml_prefix))) {
86
		print_info_box_np(gettext("ERROR: Invalid path specified."));
87
		die;
88
	}
89
	if (file_exists($pkg_full_path)) {
90
		$pkg = parse_xml_config_pkg($pkg_full_path, "packagegui");
91
	} else {
92
		include("head.inc");
93
		print_info_box_np(gettext("File not found ") . htmlspecialchars($xml));
94
		include("foot.inc");
95
		exit;
96
	}
97
}
98

    
99
if ($pkg['donotsave'] != "") {
100
	header("Location: pkg_edit.php?xml=" . $xml);
101
	exit;
102
}
103

    
104
if ($pkg['include_file'] != "") {
105
	require_once($pkg['include_file']);
106
}
107

    
108
if ($_REQUEST['startdisplayingat']) {
109
	$startdisplayingat = $_REQUEST['startdisplayingat'];
110
}
111

    
112
if ($_REQUEST['display_maximum_rows']) {
113
	if ($_REQUEST['display_maximum_rows']) {
114
		$display_maximum_rows = $_REQUEST['display_maximum_rows'];
115
	}
116
}
117

    
118
$evaledvar = $config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'];
119

    
120
if ($_GET['act'] == "update") {
121

    
122
	if (is_array($config['installedpackages'][$pkg['name']]) && $pkg['name'] != "" && $_REQUEST['ids'] !="") {
123
		#get current values
124
		$current_values=$config['installedpackages'][$pkg['name']]['config'];
125
		#get updated ids
126
		parse_str($_REQUEST['ids'], $update_list);
127
		#sort ids to know what to change
128
		#useful to do not lose data when using sorting and paging
129
		$sort_list=$update_list['ids'];
130
		sort($sort_list);
131
		#apply updates
132
		foreach ($update_list['ids'] as $key=> $value) {
133
			$config['installedpackages'][$pkg['name']]['config'][$sort_list[$key]]=$current_values[$update_list['ids'][$key]];
134
		}
135
		#save current config
136
		write_config();
137
		#sync package
138
		eval ("{$pkg['custom_php_resync_config_command']}");
139
	}
140
	#function called via jquery, no need to continue after save changes.
141
	exit;
142
}
143
if ($_GET['act'] == "del") {
144
	// loop through our fieldnames and automatically setup the fieldnames
145
	// in the environment.	ie: a fieldname of username with a value of
146
	// testuser would automatically eval $username = "testuser";
147
	foreach ($evaledvar as $ip) {
148
		if ($pkg['adddeleteeditpagefields']['columnitem']) {
149
			foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {
150
				${xml_safe_fieldname($column['fielddescr'])} = $ip[xml_safe_fieldname($column['fieldname'])];
151
			}
152
		}
153
	}
154

    
155
	$a_pkg = &$config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'];
156

    
157
	if ($a_pkg[$_GET['id']]) {
158
		unset($a_pkg[$_GET['id']]);
159
		write_config();
160
		if ($pkg['custom_delete_php_command'] != "") {
161
			if ($pkg['custom_php_command_before_form'] != "") {
162
				eval($pkg['custom_php_command_before_form']);
163
			}
164
			eval($pkg['custom_delete_php_command']);
165
		}
166
		header("Location:  pkg.php?xml=" . $xml);
167
		exit;
168
	}
169
}
170

    
171
ob_start();
172

    
173
$iflist = get_configured_interface_with_descr(false, true);
174
$evaledvar = $config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'];
175

    
176
if ($pkg['custom_php_global_functions'] != "") {
177
	eval($pkg['custom_php_global_functions']);
178
}
179

    
180
if ($pkg['custom_php_command_before_form'] != "") {
181
	eval($pkg['custom_php_command_before_form']);
182
}
183

    
184
// Breadcrumb
185
if ($pkg['title'] != "") {
186
	if (!$only_edit) {
187
 		$pkg['title'] = $pkg['title'] . '/Edit';
188
	}
189
	if (strpos($pkg['title'], '/')) {
190
		$title = explode('/', $pkg['title']);
191

    
192
		foreach ($title as $subtitle) {
193
			$pgtitle[] = gettext($subtitle);
194
		}
195
	} else {
196
		$pgtitle = array(gettext("Package"), gettext($pkg['title']));
197
	}
198
} else {
199
	$pgtitle = array(gettext("Package"), gettext("Editor"));
200
}
201

    
202
include("head.inc");
203

    
204
?>
205

    
206
<script type="text/javascript">
207
//<![CDATA[
208
events.push(function() {
209

    
210
	function setFilter(filtertext) {
211
		jQuery('#pkg_filter').val(filtertext);
212
		document.pkgform.submit();
213
	}
214

    
215
<?php
216
	if ($pkg['adddeleteeditpagefields']['movable']) {
217
?>
218
		$('#mainarea table tbody').sortable({
219
		items: 'tr.sortable',
220
			cursor: 'move',
221
			distance: 10,
222
			opacity: 0.8,
223
			helper: function(e, ui) {
224
				ui.children().each(function() {
225
					jQuery(this).width(jQuery(this).width());
226
				});
227
			return ui;
228
			},
229
		});
230
<?php
231
	}
232
?>
233
});
234

    
235
<?php
236
if ($pkg['adddeleteeditpagefields']['movable']) {
237
?>
238
	function save_changes_to_xml(xml) {
239
		var ids = $('#mainarea table tbody').sortable('serialize', {key:"ids[]"});
240
		var strloading="<?=gettext('Saving changes...')?>";
241
		if (confirm("<?=gettext("Do you really want to save changes?")?>")) {
242
			$.ajax({
243
				type: 'get',
244
				cache: false,
245
				url: "<?=$_SERVER['SCRIPT_NAME']?>",
246
				data: {xml:'<?=$xml?>', act:'update', ids: ids},
247
				beforeSend: function() {
248
					$('#savemsg').empty().html(strloading);
249
				},
250
				error: function(data) {
251
					$('#savemsg').empty().html('Error:' + data);
252
				},
253
				success: function(data) {
254
					$('#savemsg').empty().html(data);
255
				}
256
			});
257
		}
258
	}
259
<?php
260
}
261
?>
262

    
263
//]]>
264
</script>
265

    
266
<?php
267
if ($_GET['savemsg'] != "") {
268
	$savemsg = htmlspecialchars($_GET['savemsg']);
269
}
270

    
271
if ($savemsg) {
272
	print_info_box($savemsg, 'success');
273
}
274
?>
275

    
276
<form action="pkg.php" name="pkgform" method="get">
277
	<input type='hidden' name='xml' value='<?=$_REQUEST['xml']?>' />
278
<?php
279
	if ($pkg['tabs'] != "") {
280
		$tab_array = array();
281
		foreach ($pkg['tabs']['tab'] as $tab) {
282
			if ($tab['tab_level']) {
283
				$tab_level = $tab['tab_level'];
284
			} else {
285
				$tab_level = 1;
286
			}
287
			if (isset($tab['active'])) {
288
				$active = true;
289
			} else {
290
				$active = false;
291
			}
292
			if (isset($tab['no_drop_down'])) {
293
				$no_drop_down = true;
294
			}
295
			$urltmp = "";
296
			if ($tab['url'] != "") {
297
				$urltmp = $tab['url'];
298
			}
299
			if ($tab['xml'] != "") {
300
				$urltmp = "pkg_edit.php?xml=" . $tab['xml'];
301
			}
302

    
303
			$addresswithport = getenv("HTTP_HOST");
304
			$colonpos = strpos($addresswithport, ":");
305
			if ($colonpos !== False) {
306
				//my url is actually just the IP address of the pfsense box
307
				$myurl = substr($addresswithport, 0, $colonpos);
308
			} else {
309
				$myurl = $addresswithport;
310
			}
311
			// eval url so that above $myurl item can be processed if need be.
312
			$url = str_replace('$myurl', $myurl, $urltmp);
313

    
314
			$tab_array[$tab_level][] = array(
315
				$tab['text'],
316
				$active,
317
				$url
318
			);
319
		}
320

    
321
		ksort($tab_array);
322
		foreach ($tab_array as $tab) {
323
			display_top_tabs($tab, $no_drop_down);
324
		}
325
	}
326
?>
327
		<div id="mainarea" class="panel panel-default">
328
			<table id="mainarea" class="table table-striped table-hover table-condensed">
329
				<thead>
330
<?php
331
	/* Handle filtering bar A-Z */
332
	$include_filtering_inputbox = false;
333
	$colspan = 0;
334
	if ($pkg['adddeleteeditpagefields']['columnitem'] != "") {
335
		foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {
336
			$colspan++;
337
		}
338
	}
339
	if ($pkg['fields']['field']) {
340
		// First find the sorting type field if it exists
341
		foreach ($pkg['fields']['field'] as $field) {
342
			if ($field['type'] == "sorting") {
343
				if (isset($field['include_filtering_inputbox'])) {
344
					$include_filtering_inputbox = true;
345
				}
346
				if ($display_maximum_rows < 1) {
347
					if ($field['display_maximum_rows']) {
348
						$display_maximum_rows = $field['display_maximum_rows'];
349
					}
350
				}
351
				echo "<tr><td colspan='$colspan' align='center'>";
352
				echo "Filter by: ";
353
				$isfirst = true;
354
				for ($char = 65; $char < 91; $char++) {
355
					if (!$isfirst) {
356
						echo " | ";
357
					}
358
					echo "<a href=\"#\" onclick=\"setFilter('" . chr($char) . "');\">" . chr($char) . "</a>";
359
					$isfirst = false;
360
				}
361
				echo "</td></tr>";
362
				echo "<tr><td colspan='$colspan' align='center'>";
363
				if ($field['sortablefields']) {
364
					echo "Filter field: <select name='pkg_filter_type'>";
365
					foreach ($field['sortablefields']['item'] as $si) {
366
						if ($si['name'] == $_REQUEST['pkg_filter_type']) {
367
							$SELECTED = "selected";
368
						} else {
369
							$SELECTED = "";
370
						}
371
						echo "<option value='{$si['name']}' {$SELECTED}>{$si['name']}</option>";
372
					}
373
					echo "</select>";
374
				}
375
				if ($include_filtering_inputbox) {
376
					echo "&nbsp;&nbsp;Filter text: <input id='pkg_filter' name='pkg_filter' value='" . $_REQUEST['pkg_filter'] . "' /><input type='submit' value='Filter' />";
377
				}
378
				echo "</td></tr><tr><td><font size='-3'>&nbsp;</font></td></tr>";
379
			}
380
		}
381
	}
382
?>
383
				<tr>
384

    
385
<?php
386
	if ($display_maximum_rows) {
387
		$totalpages = ceil(round((count($evaledvar) / $display_maximum_rows), 9));
388
		$page = 1;
389
		$tmpcount = 0;
390
		$tmppp = 0;
391
		if (is_array($evaledvar)) {
392
			foreach ($evaledvar as $ipa) {
393
				if ($tmpcount == $display_maximum_rows) {
394
					$page++;
395
					$tmpcount = 0;
396
				}
397
				if ($tmppp == $startdisplayingat) {
398
					break;
399
				}
400
				$tmpcount++;
401
				$tmppp++;
402
			}
403
		}
404
		echo "<tr><th colspan='" . count($pkg['adddeleteeditpagefields']['columnitem']) . "'>";
405
		echo "<table width='100%' summary=''>";
406
		echo "<tr>";
407
		echo "<td align='left'>Displaying page $page of $totalpages</b></td>";
408
		echo "<td align='right'>Rows per page: <select onchange='document.pkgform.submit();' name='display_maximum_rows'>";
409
		for ($x = 0; $x < 250; $x++) {
410
			if ($x == $display_maximum_rows) {
411
				$SELECTED = "selected";
412
			} else {
413
				$SELECTED = "";
414
			}
415
			echo "<option value='$x' $SELECTED>$x</option>\n";
416
			$x = $x + 4;
417
		}
418
		echo "</select></td></tr>";
419
		echo "</table>";
420
		echo "</th></tr>";
421
	}
422

    
423
	$cols = 0;
424
	if ($pkg['adddeleteeditpagefields']['columnitem'] != "") {
425
		foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {
426
			echo "<th class=\"listhdrr\">" . $column['fielddescr'] . "</th>";
427
			$cols++;
428
		}
429
	}
430
?>
431
				</tr>
432
				</thead>
433
				<tbody>
434
<?php
435
	$i = 0;
436
	$pagination_counter = 0;
437
	if ($evaledvar) {
438
		foreach ($evaledvar as $ip) {
439
			if ($startdisplayingat) {
440
				if ($i < $startdisplayingat) {
441
					$i++;
442
					continue;
443
				}
444
			}
445
			if ($_REQUEST['pkg_filter']) {
446
				// Handle filtered items
447
				if ($pkg['fields']['field'] && !$filter_regex) {
448
					// First find the sorting type field if it exists
449
					foreach ($pkg['fields']['field'] as $field) {
450
						if ($field['type'] == "sorting") {
451
							if ($field['sortablefields']['item']) {
452
								foreach ($field['sortablefields']['item'] as $sf) {
453
									if ($sf['name'] == $_REQUEST['pkg_filter_type']) {
454
										$filter_fieldname = $sf['fieldname'];
455
										#Use a default regex on sortable fields when none is declared
456
										if ($sf['regex']) {
457
											$filter_regex = str_replace("%FILTERTEXT%", $_REQUEST['pkg_filter'], trim($sf['regex']));
458
										} else {
459
											$filter_regex = "/{$_REQUEST['pkg_filter']}/i";
460
										}
461
									}
462
								}
463
							}
464
						}
465
					}
466
				}
467
				// Do we have something to filter on?
468
				unset($filter_matches);
469
				if ($pkg['adddeleteeditpagefields']['columnitem'] != "") {
470
					foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {
471
						$fieldname = $ip[xml_safe_fieldname($column['fieldname'])];
472
						if ($column['fieldname'] == $filter_fieldname) {
473
							if ($filter_regex) {
474
								//echo "$filter_regex - $fieldname<p/>";
475
								preg_match($filter_regex, $fieldname, $filter_matches);
476
								break;
477
							}
478
						}
479
					}
480
				}
481
				if (!$filter_matches) {
482
					$i++;
483
					continue;
484
				}
485
			}
486
			if ($pkg['adddeleteeditpagefields']['movable']) {
487
				echo "<tr valign=\"top\" class=\"sortable\" id=\"id_{$i}\">\n";
488
			} else {
489
				echo "<tr valign=\"top\">\n";
490
			}
491
			if ($pkg['adddeleteeditpagefields']['columnitem'] != "") {
492
				foreach ($pkg['adddeleteeditpagefields']['columnitem'] as $column) {
493
					if ($column['fieldname'] == "description") {
494
						$class = "listbg";
495
					} else {
496
						$class = "listlr";
497
					}
498
?>
499
					<td class="<?=$class?>" ondblclick="document.location='pkg_edit.php?xml=<?=$xml?>&amp;act=edit&amp;id=<?=$i?>';">
500
<?php
501
					$fieldname = $ip[xml_safe_fieldname($column['fieldname'])];
502
					#Check if columnitem has a type field declared
503
					if ($column['type'] == "checkbox") {
504
						if ($fieldname == "") {
505
							echo gettext("No");
506
						} else {
507
							echo gettext("Yes");
508
						}
509
					} else if ($column['type'] == "interface") {
510
						echo $column['prefix'] . $iflist[$fieldname] . $column['suffix'];
511
					} else {
512
						#Check if columnitem has an encoding field declared
513
						if ($column['encoding'] == "base64") {
514
							echo $column['prefix'] . base64_decode($fieldname) . $column['suffix'];
515
						#Check if there is a custom info to show when $fieldname is not empty
516
						} else if ($column['listmodeon'] && $fieldname != "") {
517
							echo $column['prefix'] . gettext($column['listmodeon']). $column['suffix'];
518
						#Check if there is a custom info to show when $fieldname is empty
519
						} else if ($column['listmodeoff'] && $fieldname == "") {
520
							echo $column['prefix'] .gettext($column['listmodeoff']). $column['suffix'];
521
						} else {
522
							echo $column['prefix'] . $fieldname ." ". $column['suffix'];
523
						}
524
					}
525
?>
526
					</td>
527
<?php
528
				} // foreach columnitem
529
			} // if columnitem
530
?>
531
					<td valign="middle" class="list nowrap">
532
						<table border="0" cellspacing="0" cellpadding="1" summary="icons">
533
							<tr>
534
<?php
535
			#Show custom description to edit button if defined
536
			$edit_msg=($pkg['adddeleteeditpagefields']['edittext']?$pkg['adddeleteeditpagefields']['edittext']:"Edit this item");
537
?>
538
								<td><a class="btn btn-xs btn-info" href="pkg_edit.php?xml=<?=$xml?>&amp;act=edit&amp;id=<?=$i?>"><?=$edit_msg?></a></td>
539
<?php
540
			#Show custom description to delete button if defined
541
			$delete_msg=($pkg['adddeleteeditpagefields']['deletetext']?$pkg['adddeleteeditpagefields']['deletetext']:"Delete this item");
542
?>
543
								<td>&nbsp;<a class="btn btn-xs btn-danger" href="pkg.php?xml=<?=$xml?>&amp;act=del&amp;id=<?=$i?>"><?=gettext("Delete")?></a></td>
544
							</tr>
545
						</tbody>
546
					</table>
547
				</td>
548
<?php
549
			echo "</tr>\n"; // Pairs with an echo tr some way above
550
			// Handle pagination and display_maximum_rows
551
			if ($display_maximum_rows) {
552
				if ($pagination_counter == ($display_maximum_rows-1) or
553
					$i == (count($evaledvar)-1)) {
554
					$colcount = count($pkg['adddeleteeditpagefields']['columnitem']);
555
					$final_footer = "";
556
					$final_footer .= "<tr><td colspan='$colcount'>";
557
					$final_footer .= "<table width='100%' summary=''><tr>";
558
					$final_footer .= "<td align='left'>";
559
					$startingat = $startdisplayingat - $display_maximum_rows;
560
					if ($startingat > -1) {
561
						$final_footer .= "<a href='pkg.php?xml=" . $_REQUEST['xml'] . "&amp;startdisplayingat={$startingat}&amp;display_maximum_rows={$display_maximum_rows}'>";
562
					} else if ($startdisplayingat > 1) {
563
						$final_footer .= "<a href='pkg.php?xml=" . $_REQUEST['xml'] . "&amp;startdisplayingat=0&amp;display_maximum_rows={$display_maximum_rows}'>";
564
					}
565
					$final_footer .= "<font size='2'><< Previous page</font></a>";
566
					if ($tmppp + $display_maximum_rows > count($evaledvar)) {
567
						$endingrecord = count($evaledvar);
568
					} else {
569
						$endingrecord = $tmppp + $display_maximum_rows;
570
					}
571
					$final_footer .= "</td><td align='center'>";
572
					$tmppp++;
573
					$final_footer .= "<font size='2'>Displaying {$tmppp} - {$endingrecord} / " . count($evaledvar) . " records";
574
					$final_footer .= "</font></td><td align='right'>&nbsp;";
575
					if (($i+1) < count($evaledvar)) {
576
						$final_footer .= "<a href='pkg.php?xml=" . $_REQUEST['xml'] . "&amp;startdisplayingat=" . ($startdisplayingat + $display_maximum_rows) . "&amp;display_maximum_rows={$display_maximum_rows}'>";
577
					}
578
					$final_footer .= "<font size='2'>Next page >></font></a>";
579
					$final_footer .= "</td></tr></table></td></tr>";
580
					$i = count($evaledvar);
581
					break;
582
				}
583
			}
584
			$i++;
585
			$pagination_counter++;
586
		} // foreach evaledvar
587
	} // if evaledvar
588
?>
589
				<tr>
590
					<td colspan="<?=$cols?>"></td>
591
					<td>
592
						<table border="0" cellspacing="0" cellpadding="1" summary="icons">
593
							<tr>
594
<?php
595
	#Show custom description to add button if defined
596
	$add_msg=($pkg['adddeleteeditpagefields']['addtext']?$pkg['adddeleteeditpagefields']['addtext']:"Add a new item");
597
?>
598
								<td><a href="pkg_edit.php?xml=<?=$xml?>&amp;id=<?=$i?>" class="btn btn-sm btn-success"><?=gettext('Add')?></a></td>
599
<?php
600
	#Show description button and info if defined
601
	if ($pkg['adddeleteeditpagefields']['description']) {
602
?>
603
								<td>
604
									<i class="fa fa-info-circle"><?=$pkg['adddeleteeditpagefields']['description']?></i>
605
								</td>
606
<?php
607
	}
608
?>
609
							</tr>
610
						</table>
611
					</td>
612
				</tr>
613
				<?=$final_footer?>
614
<?php
615
	#Show save button only when movable is defined
616
	if ($pkg['adddeleteeditpagefields']['movable']) {
617
?>
618

    
619

    
620

    
621
<?php
622
	}
623
?>
624
			</table>
625
			</div>
626
		<input class="btn btn-primary" type="button" value="Save" name="Submit" onclick="save_changes_to_xml('<?=$xml?>')" />
627

    
628
</form>
629
<?php
630
echo "<!-- filter_fieldname: {$filter_fieldname} -->";
631
echo "<!-- filter_regex: {$filter_regex} -->";
632

    
633
include("foot.inc"); ?>
(100-100/228)