Iframe panel

This commit is contained in:
Kload 2013-10-29 09:16:30 +00:00
parent ce6e099f1b
commit dc00adc86e
3 changed files with 56 additions and 3 deletions

View file

@ -163,7 +163,7 @@ function set_headers (user)
ngx.req.set_header("Authorization", "Basic "..ngx.encode_base64( ngx.req.set_header("Authorization", "Basic "..ngx.encode_base64(
user..":"..cache:get(user.."-password") user..":"..cache:get(user.."-password")
)) ))
-- Set Additional headers -- Set Additional headers
for k, v in pairs(conf["additional_headers"]) do for k, v in pairs(conf["additional_headers"]) do
ngx.req.set_header(k, cache:get(user.."-"..v)) ngx.req.set_header(k, cache:get(user.."-"..v))
@ -247,7 +247,8 @@ function serve(uri)
rendered = rendered..hige.render(content, data) rendered = rendered..hige.render(content, data)
content = rendered..hige.render(read_file(script_path.."portal/footer.ms"), data) content = rendered..hige.render(read_file(script_path.."portal/footer.ms"), data)
elseif ext == "ms" then elseif ext == "ms" then
content = hige.render(content, {}) local data = get_data_for(file)
content = hige.render(content, data)
end end
-- Reset flash messages -- Reset flash messages
@ -303,6 +304,12 @@ function get_data_for(view)
mailalias = mails["mailalias"], mailalias = mails["mailalias"],
maildrop = mails["maildrop"] maildrop = mails["maildrop"]
} }
elseif view == "panel.ms" then
data = { app = {} }
for url, name in pairs(conf["users"][user]) do
table.insert(data["app"], { url = url, name = name })
end
end end
data['flash_fail'] = {flashs["fail"]} data['flash_fail'] = {flashs["fail"]}

View file

@ -39,3 +39,30 @@ iframe {
#ynhtoggle:hover { #ynhtoggle:hover {
text-decoration: none; text-decoration: none;
} }
.ynhapp {
float: left;
margin: 5px 15px;
padding: 5px;
width: 70px;
height: 100px;
color: white;
text-align: center;
cursor: pointer;
text-decoration: none;
}
.ynhapp.active .ynhappsquare {
border: 1px dotted white;
}
.ynhappcaption {
color: white;
font-size: 13px;
text-decoration: none;
}
.ynhappsquare {
height: 50px;
width: 64px;
padding-top: 14px;
vertical-align: middle;
font-size: 35px;
border: 1px solid white;
}

View file

@ -13,7 +13,7 @@
<script src="assets/js/jquery-1.10.2.min.js"></script> <script src="assets/js/jquery-1.10.2.min.js"></script>
</head> </head>
<body class="gradient" style="overflow: hidden"> <body class="gradient" style="overflow: hidden">
<iframe name="glu" id="glu" width="100%" src="/" style=""></iframe> <iframe name="glu" id="glu" width="100%" src="https://megusta7.com/webmaaail/" style=""></iframe>
<script> <script>
var ynh = {}; var ynh = {};
ynh.jquery = jQuery.noConflict(); ynh.jquery = jQuery.noConflict();
@ -46,12 +46,21 @@ ynh.jquery = jQuery.noConflict();
} }
} }
function changeTitle() {
if (top.glu.document.title)
top.document.title = top.glu.document.title;
else
top.document.title = 'Yunohost Apps';
}
var tid = setInterval(changeTitle, 10000);
$( document ).ready(function($) { $( document ).ready(function($) {
h = 107; h = 107;
$("#glu").load(function() { $("#glu").load(function() {
setTimeout(function() { setTimeout(function() {
changeTitle();
if ($("#ynhtopbar").length == 0) { if ($("#ynhtopbar").length == 0) {
$('body').children().filter(function() { $('body').children().filter(function() {
return $(this).css("position") === 'absolute' || $(this).css("position") === 'fixed'; return $(this).css("position") === 'absolute' || $(this).css("position") === 'fixed';
@ -59,6 +68,9 @@ ynh.jquery = jQuery.noConflict();
return parseFloat(value) + h + 3; return parseFloat(value) + h + 3;
}}); }});
$("body").append('<div id="ynhtopbar"><div id="ynhtoggle" class="ynhopen">YunoHost</div></div>'); $("body").append('<div id="ynhtopbar"><div id="ynhtoggle" class="ynhopen">YunoHost</div></div>');
{{#app}}
$("#ynhtopbar").append('<div class="ynhapp" data-href="https://{{url}}"><div class="ynhappsquare">R</div><div class="ynhappcaption">{{name}}</div></div>');
{{/app}}
} }
$("body").css({marginTop: function(index, value) { $("body").css({marginTop: function(index, value) {
return parseFloat(value) + h + 3; return parseFloat(value) + h + 3;
@ -72,6 +84,13 @@ ynh.jquery = jQuery.noConflict();
checkScroll("bottom"); checkScroll("bottom");
checkScroll("top"); checkScroll("top");
}); });
$(".ynhapp").on("click", function(event) {
event.preventDefault();
parent.glu.location.href = $(this).attr('data-href');
$('.ynhapp.active').removeClass('active');
$(this).addClass('active');
});
}, 10); }, 10);
$(window).resize(function() { $(window).resize(function() {