File: tabs.php

package info (click to toggle)
bamboo 1.2-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 580 kB
  • ctags: 1,338
  • sloc: php: 4,061; makefile: 44; sh: 36
file content (56 lines) | stat: -rw-r--r-- 1,194 bytes parent folder | download
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
<?php

if ($page->path == "/.trash" || $page->path == "/.clipboard")
	return;
	
function tab($label, $action, $default=false) {
    global $root;
    static $count=0;
    $count++;
    
    $key = preg_replace('!.*<u>(.*)</u>.*!i','$1',$label);
    $label = str_replace(' ', '&nbsp;', $label);

	$ea = get('eaction',get('ea',''));	
	if ($ea=='' || $ea=='saveedit' || $ea=='saveview')
		$active = $default;
	else
		$active = $ea==$action;
		
	$class = $active ? "class=here" : "";
	$accesskey = $key ? "accesskey=$key" : '';
	echo "<td $class class=tab$count>";
		echo alink("?a=edit&ea=$action", $label, $accesskey);
	echo "</td>\n";
}

?><table cellspacing=4><tr>
<?php

$tabs = @$GLOBALS['edit-tabs'];

if ($tabs) {
	foreach($tabs as $label => $info) {
		if (is_array($info)) {
			$default = true;
			$action = $info[0];
		}
		else {
			$default = false;
			$action = $info;
		}
		tab($label,$action,$default);
	}
}
else {
	tab('Page <u>I</u>nfo','info');
	tab('<u>E</u>dit Content','edit',true);
	tab('<u>P</u>roperties','props');
#	tab('Per<u>m</u>issions','perms');
#	tab('Ve<u>r</u>sions','versions');
	tab('P<u>r</u>eview','preview');
	tab('Vie<u>w</u> Site','view');
}

?>
</tr></table>