1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-11-20 02:18:20 +01:00
antd-web-apps/info/index.ls.old

196 lines
7.5 KiB
Plaintext
Raw Normal View History

2018-02-21 19:04:26 +01:00
<?lua
std.html()
local user = "mrsang"
2018-02-20 18:55:25 +01:00
local die = function(m)
echo(m)
debug.traceback=nil
error("Permission denied")
end
2018-02-21 19:04:26 +01:00
local sectionByCID = function(id)
local db = require("db.model").get(user,"cv_sections",nil)
if db == nil then die("Cannot get the cv_sections table") end
local cond = { exp = { ["="] = { cid = id } } , order = { start = "DESC" } }
local data, a = db:find(cond)
db:close()
return data, a
end
local db = require("db.model").get(user,"user",nil)
2018-02-20 18:55:25 +01:00
if db == nil then die("cannot get db data") end
2018-02-21 19:04:26 +01:00
local data, a = db:getAll()
2018-02-20 18:55:25 +01:00
db:close()
2018-03-07 14:18:25 +01:00
if data == nil or data[1] == nil then die("Cannot fetch user info") end
data = data[1]
2018-02-20 18:55:25 +01:00
?>
2018-02-20 18:24:03 +01:00
<html>
<head>
2018-02-20 18:55:25 +01:00
<!--script type="text/javascript" src="../os/scripts/jquery-3.2.1.min.js"></script-->
2018-03-18 14:22:15 +01:00
<script type="text/javascript" src="rst/gscripts/showdown.min.js"></script>
2018-03-05 22:40:43 +01:00
<!--link rel="stylesheet" type="text/css" href="grs/ubuntu-regular.css" /-->
2018-02-20 18:24:03 +01:00
<link rel="stylesheet" type="text/css" href="style.css" />
2018-02-21 19:04:26 +01:00
<link rel="stylesheet" type="text/css" href="rst/font-awesome.css" />
<title>Porfolio</title>
2018-02-20 18:24:03 +01:00
</head>
<body>
2018-02-21 19:04:26 +01:00
<div class="layout">
<div class = "cv-content">
2018-02-20 18:24:03 +01:00
<h1>
2018-02-20 18:55:25 +01:00
<span class="name"><?=data.fullname?></span>
2018-02-20 18:24:03 +01:00
<span class="cv">Curriculum Vitae</span>
</h1>
<p class="coordination">
2018-02-20 18:55:25 +01:00
<span class="fa fa-home"></span><?=data.address?></p>
2018-02-20 18:24:03 +01:00
<p class="coordination">
<span class="fa fa-phone"></span>
2018-02-20 18:55:25 +01:00
<span class="text"><?=data.Phone?></span>
2018-02-20 18:24:03 +01:00
<span class="fa fa-envelope-o"></span>
2018-02-20 18:55:25 +01:00
<span class="text"><?=data.email?></span>
2018-02-20 18:24:03 +01:00
<span class="fa fa-globe"></span>
2018-02-21 19:04:26 +01:00
<span class="text"><a href ="<?=data.url?>"><?=data.url?></a></span>
2018-02-20 18:24:03 +01:00
</p>
<p class="shortbio">
<span class="fa fa-quote-left"></span>
2018-02-20 18:55:25 +01:00
<span><?=data.shortbiblio?></span>
2018-02-20 18:24:03 +01:00
<span class="fa fa-quote-right"></span>
</p>
2018-02-21 19:04:26 +01:00
<?lua
-- query the the sections list
db = require("db.model").get(user,"cv_cat",nil)
if db == nil then die("Cannot get the cv_cat table") end
local cond = { exp = { ["="] = { pid = 0 } }, order = { name = "ASC" } }
data, a = db:find(cond)
if data then
for k, idx in pairs(a) do
local cat = data[idx]
cond = { exp = { ["="] = { pid = cat.id } }, order = { name = "ASC" } }
local children, b = db:find(cond)
if children and #children > 0 then -- we have the sub childrent
?>
2018-02-22 00:04:14 +01:00
<div class="container" id =<?='"toc'..idx..'"'?>>
2018-02-21 19:04:26 +01:00
<h1><?=cat.name:gsub("^%d+%.","")?></h1>
<?lua
for l, j in pairs(b) do
local child = children[j]
?>
2018-02-20 18:24:03 +01:00
<div class="sub-container">
2018-02-21 19:04:26 +01:00
<h2><?=child.name:gsub("^%d+%.","")?></h2>
<?lua
local entries, c = sectionByCID(child.id)
if entries then
for m, k in pairs(c) do
local entry = entries[k]
?>
2018-02-20 18:24:03 +01:00
<div class= "entry">
<p>
2018-02-21 19:04:26 +01:00
<?lua if entry.title ~= "" then ?>
<span class= "fa fa-bookmark"></span>
<span class= "title"><?=entry.title?></span>
<?lua end ?>
2018-02-20 18:24:03 +01:00
<span class= "title-optional"></span>
2018-02-21 19:04:26 +01:00
<span class="location"><?=entry.location?></span>
2018-02-20 18:24:03 +01:00
</p>
<div class="entry-short-des">
2018-02-21 19:04:26 +01:00
<span><?=entry.subtitle?></span>
<span class="date">
<?lua
if entry["start"]:match("^20%d.*") and entry['end']:match("^20%d.*") then
echo(entry.start.."-"..entry['end'])
end
?>
</span>
2018-02-20 18:24:03 +01:00
</div>
<div class="entry-description">
2018-02-21 19:04:26 +01:00
<?=entry.content?>
2018-02-20 18:24:03 +01:00
</div>
</div>
2018-02-21 19:04:26 +01:00
<?lua
end
end
?>
2018-02-20 18:24:03 +01:00
</div>
2018-02-21 19:04:26 +01:00
<?lua
end
?>
</div>
<?lua
else
?>
2018-02-22 00:04:14 +01:00
<div class="container" id =<?='"toc'..idx..'"'?>>
2018-02-21 19:04:26 +01:00
<h1><?=cat.name:gsub("^%d+%.","")?></h1>
<?lua
local entries, c = sectionByCID(cat.id)
if entries then
for m, k in pairs(c) do
local entry = entries[k]
?>
2018-02-20 18:24:03 +01:00
<div class= "entry">
<p>
2018-02-21 19:04:26 +01:00
<?lua if entry.title ~= "" then ?>
<span class= "fa fa-bookmark"></span>
<span class= "title"><?=entry.title?></span>
<?lua end ?>
<span class= "title-optional"></span>
<span class="location"><?=entry.location?></span>
2018-02-20 18:24:03 +01:00
</p>
<div class="entry-short-des">
2018-02-21 19:04:26 +01:00
<span><?=entry.subtitle?></span>
<span class="date">
<?lua
if entry["start"]:match("^20%d.*") and entry['end']:match("^20%d.*") then
echo(entry.start.."-"..entry['end'])
end
?>
2018-02-20 18:24:03 +01:00
</span>
</div>
<div class="entry-description">
2018-02-21 19:04:26 +01:00
<?=entry.content?>
2018-02-20 18:24:03 +01:00
</div>
</div>
2018-02-21 19:04:26 +01:00
<?lua
end
end
echo ("</div>")
end
end
db:close()
end
?>
<div class = "container">
<h1 style="margin:0;"></h1>
<p style="text-align:right; padding:0; margin:0;color:#878887;">Powered by antd server, (C) 2017-2018 Xuan Sang LE</p>
2018-02-20 18:24:03 +01:00
</div>
</div>
2018-02-25 13:54:37 +01:00
<?lua
2018-07-12 10:49:40 +02:00
if (not HEADER.mobile) and (REQUEST.query.print ~= "true") then
2018-02-25 13:54:37 +01:00
?>
2018-02-21 19:04:26 +01:00
<div class = "cv-toc">
<ul>
<?lua
if data then
for k, idx in pairs(a) do
local cat = data[idx]
?>
2018-02-22 00:04:14 +01:00
<li><a href=<?='"#toc'..idx..'"'?>><?=cat.name:gsub("^%d+%.","")?></a></li>
2018-02-21 19:04:26 +01:00
<?lua
end
end
?>
</ul>
</div>
2018-02-25 13:54:37 +01:00
<?lua end ?>
2018-02-21 19:04:26 +01:00
</div>
<script>
window.onload = function()
{
var els = document.getElementsByClassName("entry-description");
var converter = new showdown.Converter();
for(var i in els)
{
var text = els[i].innerHTML;
var html = converter.makeHtml(text);
els[i].innerHTML = html;
}
}
</script>
2018-02-20 18:24:03 +01:00
</body>
</html>