mirror of
https://github.com/unraid/webgui.git
synced 2026-01-05 00:59:48 -06:00
New feature: Favorites
User can add sections from Settings and Tools to a new page: Favorites This allows the user to make a custom list of sections which are preferred Sections can be removed from Favorites as desired
This commit is contained in:
31
emhttp/plugins/dynamix/Favorites.page
Normal file
31
emhttp/plugins/dynamix/Favorites.page
Normal file
@@ -0,0 +1,31 @@
|
||||
Menu="Tasks:2"
|
||||
Type="xmenu"
|
||||
Code="e970"
|
||||
---
|
||||
<?
|
||||
$uri = ['settings','tools'];
|
||||
foreach($uri as $more) {
|
||||
$text = "$docroot/languages/$locale/$more.txt";
|
||||
if (file_exists($text)) {
|
||||
// additional translations
|
||||
$store = "$docroot/languages/$locale/$more.dot";
|
||||
if (!file_exists($store)) file_put_contents($store,serialize(parse_lang_file($text)));
|
||||
$language = array_merge($language,unserialize(file_get_contents($store)));
|
||||
}
|
||||
}
|
||||
?>
|
||||
<script>
|
||||
function delPage(page) {
|
||||
$.post('/webGui/include/MyFavorites.php',{action:'del',page:page},function(){refresh();});
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$('i.PanelIcon').each(function(){
|
||||
var icon = $(this);
|
||||
var page = icon.closest('a').prop('href').split('/').pop();
|
||||
icon.after('<i class="fa fa-minus-square-o favo" style="display:none" title="_(Remove from favorites)_" onclick="delPage("'+page+'");return false"></i>');
|
||||
icon.parent().parent().parent().hover(function(){icon.next().show();},function(){icon.next().hide();});
|
||||
});
|
||||
if ($('i.PanelIcon').length==0) $('#nofavs').show();
|
||||
});
|
||||
</script>
|
||||
6
emhttp/plugins/dynamix/MyFavorites.page
Normal file
6
emhttp/plugins/dynamix/MyFavorites.page
Normal file
@@ -0,0 +1,6 @@
|
||||
Menu="Favorites"
|
||||
Type="menu"
|
||||
Title="My Favorites"
|
||||
Tag="icon-shop"
|
||||
---
|
||||
<div id="nofavs" style="display:none;width:100%"><center>_(No favorites available)_</center></div>
|
||||
@@ -1,4 +1,21 @@
|
||||
Menu="Tasks:4"
|
||||
Type="xmenu"
|
||||
Tabs="false"
|
||||
Code="e924"
|
||||
Code="e924"
|
||||
---
|
||||
<script>
|
||||
function addPage(page) {
|
||||
$.post('/webGui/include/MyFavorites.php',{action:'add',page:page},function(){
|
||||
swal({title:"_(Added to Favorites)_",text:"",type:"success",html:true,confirmButtonText:"_(Ok)_"});
|
||||
});
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$('i.PanelIcon').each(function(){
|
||||
var icon = $(this);
|
||||
var page = icon.closest('a').prop('href').split('/').pop();
|
||||
icon.after('<i class="fa fa-plus-square-o favo" style="display:none" title="_(Add to favorites)_" onclick="addPage("'+page+'");return false"></i>');
|
||||
icon.parent().parent().parent().hover(function(){icon.next().show();},function(){icon.next().hide();});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
Menu="Tasks:90"
|
||||
Type="xmenu"
|
||||
Tabs="false"
|
||||
Code="e909"
|
||||
Code="e909"
|
||||
---
|
||||
<script>
|
||||
function addPage(page) {
|
||||
$.post('/webGui/include/MyFavorites.php',{action:'add',page:page},function(){
|
||||
swal({title:"_(Added to Favorites)_",text:"",type:"success",html:true,confirmButtonText:"_(Ok)_"});
|
||||
});
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$('i.PanelIcon').each(function(){
|
||||
var icon = $(this);
|
||||
var page = icon.closest('a').prop('href').split('/').pop();
|
||||
icon.after('<i class="fa fa-plus-square-o favo" style="display:none" title="_(Add to favorites)_" onclick="addPage("'+page+'");return false"></i>');
|
||||
icon.parent().parent().parent().hover(function(){icon.next().show();},function(){icon.next().hide();});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
35
emhttp/plugins/dynamix/include/MyFavorites.php
Normal file
35
emhttp/plugins/dynamix/include/MyFavorites.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2023, Lime Technology
|
||||
* Copyright 2012-2023, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
|
||||
$permit = ['del','add'];
|
||||
$action = $_POST['action']??'';
|
||||
$page = glob("$docroot/plugins/*/{$_POST['page']}.page",GLOB_NOSORT)[0];
|
||||
// validate input
|
||||
if (!$page || !in_array($action,$permit)) exit;
|
||||
|
||||
$file = fopen($page,'r');
|
||||
// get current Menu settings
|
||||
extract(parse_ini_string(fgets($file)));
|
||||
fclose($file);
|
||||
|
||||
$Menu = str_replace(' MyFavorites','',$Menu);
|
||||
switch ($action) {
|
||||
case $permit[0]:
|
||||
break;
|
||||
case $permit[1]:
|
||||
$Menu .= ' MyFavorites';
|
||||
break;
|
||||
}
|
||||
// update Menu settings
|
||||
exec("sed -ri '0,/^Menu=\".+\"$/s//Menu=\"$Menu\"/' $page");
|
||||
@@ -19,6 +19,7 @@ i.spacing{margin-left:0;margin-right:10px}
|
||||
i.icon{font-size:1.6rem;margin-right:4px;vertical-align:middle}
|
||||
i.title{display:none}
|
||||
i.control{cursor:pointer;color:#909090;font-size:1.8rem}
|
||||
i.favo{font-size:1.8rem;position:absolute}
|
||||
pre ul{margin:0;padding-top:0;padding-bottom:0;padding-left:28px}
|
||||
pre li{margin:0;padding-top:0;padding-bottom:0;padding-left:18px}
|
||||
big{font-size:1.4rem;font-weight:bold;text-transform:uppercase}
|
||||
|
||||
@@ -19,6 +19,7 @@ i.spacing{margin-left:-6px}
|
||||
i.icon{font-size:1.6rem;margin-right:4px;vertical-align:middle}
|
||||
i.title{margin-right:8px}
|
||||
i.control{cursor:pointer;color:#606060;font-size:1.8rem}
|
||||
i.favo{font-size:1.8rem;position:absolute;margin-left:12px}
|
||||
hr{border:none;height:1px!important;color:#2b2b2b;background-color:#2b2b2b}
|
||||
input[type=text],input[type=password],input[type=number],input[type=url],input[type=email],input[type=date],input[type=file],textarea,.textarea{font-family:clear-sans;font-size:1.3rem;background-color:transparent;border:none;border-bottom:1px solid #e5e5e5;padding:4px 0;text-indent:0;min-height:2rem;line-height:2rem;outline:none;width:300px;margin:0 20px 0 0;box-shadow:none;border-radius:0;color:#f2f2f2}
|
||||
input[type=button],input[type=reset],input[type=submit],button,button[type=button],a.button{font-family:clear-sans;font-size:1.1rem;font-weight:bold;letter-spacing:1.8px;text-transform:uppercase;min-width:86px;margin:10px 12px 10px 0;padding:8px;text-align:center;text-decoration:none;white-space:nowrap;cursor:pointer;outline:none;border-radius:4px;border:none;color:#ff8c2f;background:-webkit-gradient(linear,left top,right top,from(#e22828),to(#ff8c2f)) 0 0 no-repeat,-webkit-gradient(linear,left top,right top,from(#e22828),to(#ff8c2f)) 0 100% no-repeat,-webkit-gradient(linear,left bottom,left top,from(#e22828),to(#e22828)) 0 100% no-repeat,-webkit-gradient(linear,left bottom,left top,from(#ff8c2f),to(#ff8c2f)) 100% 100% no-repeat;background:linear-gradient(90deg,#e22828 0,#ff8c2f) 0 0 no-repeat,linear-gradient(90deg,#e22828 0,#ff8c2f) 0 100% no-repeat,linear-gradient(0deg,#e22828 0,#e22828) 0 100% no-repeat,linear-gradient(0deg,#ff8c2f 0,#ff8c2f) 100% 100% no-repeat;background-size:100% 2px,100% 2px,2px 100%,2px 100%}
|
||||
@@ -209,7 +210,7 @@ div.tab [type=radio]+label~.content{display:none}
|
||||
div.tab [type=radio]:checked+label~.content{display:inline}
|
||||
div.tab [type=radio]+label{position:relative;font-size:1.4rem;letter-spacing:1.8px;padding:4px 10px;margin-right:2px;border-top-left-radius:6px;border-top-right-radius:6px;border:1px solid #6c6c6c;border-bottom:none;background-color:#3c3c3c;opacity:0.5}
|
||||
div.tab [type=radio]+label img{padding-right:4px}
|
||||
div.Panel{text-align:center;float:left;margin:0 30px 30px 12px;height:8rem}
|
||||
div.Panel{text-align:center;float:left;margin:0 0 30px 0px;padding-right:60px;height:8rem}
|
||||
div.Panel a{text-decoration:none}
|
||||
div.Panel span{height:42px;display:block}
|
||||
div.Panel:hover .PanelText{text-decoration:underline}
|
||||
|
||||
@@ -19,6 +19,7 @@ i.spacing{margin-left:0;margin-right:10px}
|
||||
i.icon{font-size:1.6rem;margin-right:4px;vertical-align:middle}
|
||||
i.title{display:none}
|
||||
i.control{cursor:pointer;color:#606060;font-size:1.8rem}
|
||||
i.favo{font-size:1.8rem;position:absolute}
|
||||
pre ul{margin:0;padding-top:0;padding-bottom:0;padding-left:28px}
|
||||
pre li{margin:0;padding-top:0;padding-bottom:0;padding-left:18px}
|
||||
big{font-size:1.4rem;font-weight:bold;text-transform:uppercase}
|
||||
|
||||
@@ -19,6 +19,7 @@ i.spacing{margin-left:-6px}
|
||||
i.icon{font-size:1.6rem;margin-right:4px;vertical-align:middle}
|
||||
i.title{margin-right:8px}
|
||||
i.control{cursor:pointer;color:#909090;font-size:1.8rem}
|
||||
i.favo{font-size:1.8rem;position:absolute;margin-left:12px}
|
||||
hr{border:none;height:1px!important;color:#e3e3e3;background-color:#e3e3e3}
|
||||
input[type=text],input[type=password],input[type=number],input[type=url],input[type=email],input[type=date],input[type=file],textarea,.textarea{font-family:clear-sans;font-size:1.3rem;background-color:transparent;border:none;border-bottom:1px solid #1c1b1b;padding:4px 0;text-indent:0;min-height:2rem;line-height:2rem;outline:none;width:300px;margin:0 20px 0 0;box-shadow:none;border-radius:0;color:#1c1b1b}
|
||||
input[type=button],input[type=reset],input[type=submit],button,button[type=button],a.button{font-family:clear-sans;font-size:1.1rem;font-weight:bold;letter-spacing:1.8px;text-transform:uppercase;min-width:86px;margin:10px 12px 10px 0;padding:8px;text-align:center;text-decoration:none;white-space:nowrap;cursor:pointer;outline:none;border-radius:4px;border:none;color:#ff8c2f;background:-webkit-gradient(linear,left top,right top,from(#e22828),to(#ff8c2f)) 0 0 no-repeat,-webkit-gradient(linear,left top,right top,from(#e22828),to(#ff8c2f)) 0 100% no-repeat,-webkit-gradient(linear,left bottom,left top,from(#e22828),to(#e22828)) 0 100% no-repeat,-webkit-gradient(linear,left bottom,left top,from(#ff8c2f),to(#ff8c2f)) 100% 100% no-repeat;background:linear-gradient(90deg,#e22828 0,#ff8c2f) 0 0 no-repeat,linear-gradient(90deg,#e22828 0,#ff8c2f) 0 100% no-repeat,linear-gradient(0deg,#e22828 0,#e22828) 0 100% no-repeat,linear-gradient(0deg,#ff8c2f 0,#ff8c2f) 100% 100% no-repeat;background-size:100% 2px,100% 2px,2px 100%,2px 100%}
|
||||
@@ -209,7 +210,7 @@ div.tab [type=radio]+label~.content{display:none}
|
||||
div.tab [type=radio]:checked+label~.content{display:inline}
|
||||
div.tab [type=radio]+label{position:relative;font-size:1.4rem;letter-spacing:1.8px;padding:4px 10px;margin-right:2px;border-top-left-radius:6px;border-top-right-radius:6px;border:1px solid #b2b2b2;border-bottom:none;background-color:#e2e2e2;opacity:0.5}
|
||||
div.tab [type=radio]+label img{padding-right:4px}
|
||||
div.Panel{text-align:center;float:left;margin:0 30px 30px 12px;height:8rem}
|
||||
div.Panel{text-align:center;float:left;margin:0 0 30px 0px;padding-right:60px;height:8rem}
|
||||
div.Panel a{text-decoration:none}
|
||||
div.Panel span{height:42px;display:block}
|
||||
div.Panel:hover .PanelText{text-decoration:underline}
|
||||
|
||||
Reference in New Issue
Block a user