blob: 0e8c590e0e6f0457978d3e9d72e0fb06bd03a1ad (
plain)
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
|
<!DOCTYPE html>
<html>
<head>
<title>
Utility macros
</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body tal:attributes="id bodyid">
<header>
<div id="header" tal:define="index php:OCP\Util::linkTo('', 'index.php')">
<a id="owncloud" tal:attributes="href index"><img class="svg" tal:attributes="src php:OCP\Util::imagePath('', 'logo-wide.svg')" src="logo-wide.svg" alt="ownCloud" /></a>
<form class="searchbox" action="#" method="post">
<input id="searchbox" class="svg" type="search" name="query" tal:attributes="value request/post/query|nothing" value="" autocomplete="off" />
</form>
<a id="logout" tal:attributes="href string:${index}?logout=true"><img class="svg" tal:attributes="src php:OCP\Util::imagePath('', 'actions/logout.svg')" i18n:attributes="alt Log out;title Log out" alt="Log out" title="Log out" src="actions/logout.svg" /></a>
</div>
</header>
<body>
<tal:block metal:define-macro="html_select_options">
<tal:block condition="options">
<tal:block tal:define="options php:isset('combine') AND array_combine(options, options) OR options" repeat="option options">
<option tal:content="option" tal:attributes></option>
</tal:block>
</tal:block>
</tal:block>
function html_select_options($options, $selected, $params=array()) {
if (!is_array($selected)){
$selected=array($selected);
}
if (isset($params['combine']) && $params['combine']){
$options = array_combine($options, $options);
}
$value_name = $label_name = false;
if (isset($params['value'])){
$value_name = $params['value'];
}
if (isset($params['label'])){
$label_name = $params['label'];
}
$html = '';
foreach($options as $value => $label){
if ($value_name && is_array($label)){
$value = $label[$value_name];
}
if ($label_name && is_array($label)){
$label = $label[$label_name];
}
$select = in_array($value, $selected) ? ' selected="selected"' : '';
$html .= '<option value="' . $value . '"' . $select . '>' . $label . '</option>'."\n";
}
return $html;
}
</body>
</html>
|