forked from tharindud/conan-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlayout.php
executable file
·106 lines (95 loc) · 3.27 KB
/
layout.php
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
// Copyright 2017, Tharindu Dissanayake <[email protected]>.
// Published under the MIT license.
require_once("conan.php");
require_once("config.php");
require_once("version.php");
define("LAYOUT_TITLE", "Conan");
define("LAYOUT_SUBTITLE", "C++ Package Manager");
define("LAYOUT_THEME", "darkly");
// Return a string to use as the indentation.
function layout_indent($indent)
{
return str_repeat("\t", $indent);
}
// Layout the page header.
function layout_header($indent, $title = "")
{
if ($title != "")
{
$title = " - ".$title;
}
$indent = layout_indent($indent);
print("<title>".LAYOUT_TITLE.": ".LAYOUT_SUBTITLE.$title."</title>\n");
print($indent."<meta charset=\"utf-8\"/>\n");
print($indent."<meta http-equiv=\"Pragma\" content=\"no-cache\"/>\n");
print($indent."<meta http-equiv=\"Expires\" content=\"-1\"/>\n");
print($indent."<link rel=\"shortcut icon\" href=\"https://www.conan.io/favicon.ico\" type=\"image/x-icon\"/>\n");
print($indent."<link rel=\"stylesheet\" href=\"https://bootswatch.com/".LAYOUT_THEME."/bootstrap.min.css\"/>\n");
print($indent."<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js\"></script>\n");
print($indent."<script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js\"></script>\n");
}
// Layout the application title.
function layout_title($indent)
{
$indent = layout_indent($indent);
print("<h1>CONAN</h1>\n");
print($indent."<h6>C++ Package Manager</h6>\n");
}
// Layout the package search form.
function layout_search_form($indent, $remote = true, $autofocus = true, $query = "")
{
$input = "";
if ($autofocus == true)
{
$input = $input." autofocus=\"true\"";
}
if ($query != "")
{
$input = $input." value=\"".$query."\"";
}
$indent = layout_indent($indent);
if ($remote == true)
{
if (CONAN_REMOTE == "")
{
$remote = "local";
$url = "";
}
else
{
$remote = CONAN_REMOTE;
$url = (CONAN_REMOTE_URL == "" ? conan_remote_list()[$remote] : CONAN_REMOTE_URL);
}
print("<h6 class=\"text-muted text-right\"><strong class=\"text-danger\">".$remote."</strong> ".$url."</h6>\n".$indent);
}
print("<form action=\"search.php\">\n");
print($indent."\t<div class=\"input-group\">\n");
print($indent."\t\t<input id=\"search\" type=\"text\" class=\"form-control input-md\" name=\"query\" placeholder=\"Search\"".$input."/>\n");
print($indent."\t\t<span class=\"input-group-btn\">\n");
print($indent."\t\t\t<button class=\"btn btn-md btn-primary\" type=\"submit\">\n");
print($indent."\t\t\t\t<i class=\"glyphicon glyphicon-search\"></i>\n");
print($indent."\t\t\t</button>\n");
print($indent."\t\t</span>\n");
print($indent."\t</div>\n");
print($indent."</form>\n");
}
// Layout an error message.
function layout_error($indent, $message)
{
$indent = layout_indent($indent);
print($indent."<div class=\"alert alert-danger\">".$message."</div>\n");
}
// Layout page footer.
function layout_footer($indent, $flush = true)
{
$indent = layout_indent($indent);
print("<div class=\"row text-muted text-center\">\n");
if ($flush == true)
{
print(str_repeat($indent."\t<br/>\n", 8));
}
print($indent."\t<h6>Powered by <a href=\"".CONAN_WEB_URL."\">conan-web</a> version ".CONAN_WEB_VERSION." | Running on ".conan_version()."</h6>\n");
print($indent."</div>\n");
}
?>