Project

General

Profile

« Previous | Next » 

Revision 3ad27058

Added by jeroen van breedam over 9 years ago

adding active tab to breadcrumb

closely review L186 - L188

View differences:

src/usr/local/www/pkg.php
183 183

  
184 184
// Breadcrumb
185 185
if ($pkg['title'] != "") {
186
	if (!$only_edit) {
187
 		$pkg['title'] = $pkg['title'] . '/Edit';
188
	}
186
	/*if (!$only_edit) {						// Is any package still making use of this?? Is this something that is still wanted, considering the breadcrumb policy https://redmine.pfsense.org/issues/5527
187
 		$pkg['title'] = $pkg['title'] . '/Edit';		// If this needs to live on, then it has to be moved to run AFTER "foreach ($pkg['tabs']['tab'] as $tab)"-loop. This due to $pgtitle[] = $tab['text']; 
188
	}*/
189 189
	if (strpos($pkg['title'], '/')) {
190 190
		$title = explode('/', $pkg['title']);
191 191

  
......
199 199
	$pgtitle = array(gettext("Package"), gettext("Editor"));
200 200
}
201 201

  
202
if ($pkg['tabs'] != "") {
203
	$tab_array = array();
204
	foreach ($pkg['tabs']['tab'] as $tab) {
205
		if ($tab['tab_level']) {
206
			$tab_level = $tab['tab_level'];
207
		} else {
208
			$tab_level = 1;
209
		}
210
		if (isset($tab['active'])) {
211
			$active = true;
212
			$pgtitle[] = $tab['text'];
213
		} else {
214
			$active = false;
215
		}
216
		if (isset($tab['no_drop_down'])) {
217
			$no_drop_down = true;
218
		}
219
		$urltmp = "";
220
		if ($tab['url'] != "") {
221
			$urltmp = $tab['url'];
222
		}
223
		if ($tab['xml'] != "") {
224
			$urltmp = "pkg_edit.php?xml=" . $tab['xml'];
225
		}
226

  
227
		$addresswithport = getenv("HTTP_HOST");
228
		$colonpos = strpos($addresswithport, ":");
229
		if ($colonpos !== False) {
230
			//my url is actually just the IP address of the pfsense box
231
			$myurl = substr($addresswithport, 0, $colonpos);
232
		} else {
233
			$myurl = $addresswithport;
234
		}
235
		// eval url so that above $myurl item can be processed if need be.
236
		$url = str_replace('$myurl', $myurl, $urltmp);
237

  
238
		$tab_array[$tab_level][] = array(
239
			$tab['text'],
240
			$active,
241
			$url
242
		);
243
	}
244

  
245
	ksort($tab_array);
246
}
247

  
202 248
include("head.inc");
249
if (isset($tab_array)) {
250
	foreach ($tab_array as $tabid => $tab) {
251
		display_top_tabs($tab); //, $no_drop_down, $tabid);
252
	}
253
}
203 254

  
204 255
?>
205 256

  
......
269 320

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

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

  
308
			$tab_array[$tab_level][] = array(
309
				$tab['text'],
310
				$active,
311
				$url
312
			);
313
		}
314

  
315
		ksort($tab_array);
316
		foreach ($tab_array as $tab) {
317
			display_top_tabs($tab, $no_drop_down);
318
		}
319
	}
320
?>
321 323
		<div id="mainarea" class="panel panel-default">
322 324
			<table id="mainarea" class="table table-striped table-hover table-condensed">
323 325
				<thead>

Also available in: Unified diff