File: jscode

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 (82 lines) | stat: -rw-r--r-- 2,373 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

            HERE LIES JAVASCRIPT CODE WHICH WE MAY OR MAY NOT
            USE IN THE FUTURE. WE HAVE USED THIS AT SOME POINT
            IN DEVELOPMENT, BUT CHOSE NOT TO USE IT BUT WANTED
            TO KEEP IT AROUND IN CASE WE USE IT IN THE FUTURE.

#infobox {
	display: block;
	height:7em;
	border:1px solid #ccc;
	padding: 2px;
	margin-bottom: 1em;
	font-size: 8pt;
}


function setinfo(str) {
    box = document.getElementById('infobox');
    box.innerHTML = str;
}
function resetinfo() {
	box = document.getElementById('infobox');
    box.innerHTML = '<?=getinfobox($page,true)?>';
}


echo '<div id="infobox">blah</div>';
echo '<script>resetinfo();</script>';

$info = addslashes(getinfobox($p,$selected));
$scripttag = ' onMouseOver=\'setinfo("' . $info . '")\' onMouseOut=\'resetinfo()\' ';

function getinfobox(&$page,$clip=false) {
	static $pagetypes = array (
		'txt'  => 'txt.png',
		'html' => 'html.png',
		'php'  => 'php.png',
		'mod'  => 'mod.png',
		'home' => 'home.png',
		'trash'=> 'trash.png',
		'clip' => 'clip.png',
		'dir'  => 'folder.png',
	);
	$ret = '';

	$title = substr($page->get('title'),0,15);
	if ($page->path == '/.trash') { $type = 'trash'; $title = "Trash"; }
	elseif ($page->path == '') { $type = 'home'; $title = "Home"; }
	elseif ($page->path == '/.clipboard') { $type = 'clip'; $title = "Clipboard"; }
	elseif ($page->get('dir')) $type = 'dir';
	else $type = $page->type;

	
	$ret .= img('img/big/'.$pagetypes[$type],'align=left');
	$ret .= "<b>$title</b><br/>";
	if ($page->get('locked'))
		$ret .= "locked ";
	else
		$ret .= "unlocked ";
	$ret .= round($page->get('size') / 1024,1) . 'K';	

	if ($page->path != '' && $page->path{1} != '.' && $clip) {
		$parent = $page->parent();
		$action = $parent->path;
		$name = basename($page->path);
		$ret .= "<br clear=all>";
		$ret .= alink("$action?a=edit&ea=info&clip=cut&quick=1","cut","");
		$ret .= " ";
		$ret .= alink("$action?a=edit&ea=info&clip=copy&quick=1","copy","");
		$ret .= " ";
		$ret .= alink("$action?a=edit&ea=info&clip=paste&quick=1","paste","");
		$ret .= " ";
		$ret .= alink("$action?a=edit&ea=info&clip=delete&quick=1","delete","");
		$ret .= " ";
		$ret .= alink("$action?a=edit&ea=info&clip=new&quick=1&child=1","new child","");
		$ret .= " ";
		$ret .= alink("$action?a=edit&ea=info&clip=new&quick=1&peer=1","new peer","");
		$ret .= " ";

	}
	return $ret;
}