mirror of
https://github.com/uroni/urbackup_backend.git
synced 2025-10-26 11:36:50 +00:00
Use select boxes instead of links for clients in statistics and settings
This commit is contained in:
parent
bdd3542b1b
commit
fa2af5a2f7
@ -133,7 +133,10 @@ ACTION_IMPL(status)
|
||||
unsigned char *ips=(unsigned char*)&client_status[j].ip_addr;
|
||||
ip=nconvert(ips[0])+"."+nconvert(ips[1])+"."+nconvert(ips[2])+"."+nconvert(ips[3]);
|
||||
|
||||
i_status=client_status[j].statusaction;
|
||||
if(!client_status[j].wrong_ident)
|
||||
i_status=client_status[j].statusaction;
|
||||
else
|
||||
i_status=11;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -48,7 +48,6 @@ ACTION_IMPL(generate_templ)
|
||||
templates.push_back("lastacts_row");
|
||||
templates.push_back("stat_general");
|
||||
templates.push_back("stat_general_row");
|
||||
templates.push_back("stat_nav_pos");
|
||||
templates.push_back("stat_user");
|
||||
templates.push_back("status");
|
||||
templates.push_back("status_row");
|
||||
|
||||
@ -8,7 +8,6 @@ tmpls.lastacts_table=new Template("<h1>#{tLast activities}</h1>\r\n\r\n<table
|
||||
tmpls.lastacts_row=new Template("<tr>\r\n\t<td class=\"tabFLeft\">#{id}</td>\r\n\t<td class=\"tabFLeft\">#{name}</td>\r\n\t<td class=\"tabFLeft\">#{action}</td>\r\n\t<td class=\"tabFLeft\">#{backuptime}</td>\r\n\t<td class=\"tabFLeft\">#{duration}</td>\r\n\t<td class=\"tabFRight\">#{size}</td>\r\n</tr>");
|
||||
tmpls.stat_general=new Template("<h1>#{tStorage allocation}</h1>\r\n\r\n<div id=\"piegraph\"><img src=\"indicator.gif\" />#{tLoading}...<br /><br /></div>\r\n\r\n<table cellspacing=\"0\" cellpadding=\"0\">\r\n<tr>\t\t\t\r\n\t<th style=\"width: 150px\" class=\"tabHeader\">#{tComputer name}</th>\r\n\t<th style=\"width: 150px\" class=\"tabHeader\">#{tImages}</th>\r\n\t<th style=\"width: 150px\" class=\"tabHeader\">#{tFiles}</th>\r\n\t<th style=\"width: 150px\" class=\"tabHeaderRight\">#{tAll}</th>\r\n</tr>\r\n#{rows}\r\n<tr>\r\n\t<td class=\"tabFRight\" colspan=\"4\" style=\"height:0px\"></td>\r\n</tr>\r\n<tr>\r\n\t<td class=\"tabFLeft\">#{tAll}</td>\r\n\t<td class=\"tabFLeft\">#{images_total}</td>\r\n\t<td class=\"tabFLeft\">#{files_total}</td>\r\n\t<td class=\"tabFRight\">#{used_total}</td>\r\n</tr>\r\n</table>\r\n\r\n<h1>#{tStorage usage}</h1>\r\n\r\n<div id=\"usagegraph\"><img src=\"indicator.gif\" />#{tLoading}...</div>");
|
||||
tmpls.stat_general_row=new Template("<tr>\r\n\t<td class=\"tabFLeft\">#{name}</td>\r\n\t<td class=\"tabFLeft\">#{images}</td>\r\n\t<td class=\"tabFLeft\">#{files}</td>\r\n\t<td class=\"tabFRight\">#{used}</td>\r\n</tr>");
|
||||
tmpls.stat_nav_pos=new Template("<a href=\"javascript: stat_client(#{id},'#{name}')\">#{name}</a>");
|
||||
tmpls.stat_user=new Template("<h1>#{tStorage usage of} #{clientname}</h1>\r\n\r\n<div id=\"usagegraph\"><img src=\"indicator.gif\" />#{tLoading}...</div>");
|
||||
tmpls.status=new Template("<h1>#{tBackup status}</h1>\r\n\r\n#{dir_error}\r\n\r\n<table cellspacing=\"0\" cellpadding=\"0\">\r\n<tr>\t\t\t\r\n\t<th style=\"width: 150px\" class=\"tabHeader\">#{tComputer name}</th>\r\n\t<th style=\"width: 150px\" class=\"tabHeader\">#{tLast seen}</th>\r\n\t<th style=\"width: 200px\" class=\"tabHeader\">#{tLast file backup}</th>\r\n\t<th style=\"width: 200px\" class=\"tabHeader\">#{tLast image backup}</th>\r\n\t<th style=\"width: 150px\" class=\"tabHeader\">#{tFile backup status}</th>\r\n\t<th style=\"width: 200px\" class=\"tabHeaderRight\">#{tImage backup status}</th>\r\n</tr>\r\n#{rows}\r\n</table>\r\n<br><br>\r\n<a href=\"javascript: show_status1(true);\">#{tShow details}</a>");
|
||||
tmpls.status_row=new Template("<tr>\r\n\t<td class=\"tabFLeft\">#{name}</td>\r\n\t<td class=\"tabFLeft\">#{lastseen}</td>\r\n\t<td class=\"tabFLeft\">#{lastbackup}</td>\r\n\t<td class=\"tabFLeft\">#{lastbackup_image}</td>\r\n\t<td class=\"tabFLeft\" style=\"#{file_style}\"><div style=\"background-color:white\">#{file_ok_t}</div></td>\r\n\t<td class=\"tabFRight\" style=\"#{image_style}\"><div style=\"background-color:white\">#{image_ok_t}</div></td>\r\n</tr>");
|
||||
|
||||
@ -1 +0,0 @@
|
||||
<a href="javascript: stat_client(#{id},'#{name}')">#{name}</a>
|
||||
@ -47,7 +47,8 @@ translations.en={
|
||||
"tdir_error_text": "The directory where UrBackup will save backups is inaccessible. Please fix that by modifying this folder in 'Settings' or by giving UrBackup rights to access this directory.",
|
||||
"starting": "Starting",
|
||||
"ident_err": "Server rejected",
|
||||
"enter_hostname": "Please enter a hostname or IP address"
|
||||
"enter_hostname": "Please enter a hostname or IP address",
|
||||
"clients": "Clients"
|
||||
}
|
||||
translations.de={
|
||||
"action_1": "Inkrementelles Datei Backup",
|
||||
@ -185,5 +186,6 @@ translations.de={
|
||||
"tNo extra clients": "Keine zusätzlichen Clients",
|
||||
"tShow details": "Details anzeigen",
|
||||
"tAutoupdate clients": "Clientprogramme automatisch aktualisieren",
|
||||
"enter_hostname": "Bitte geben Sie eine IP-Adresse oder einen Hostenamen ein"
|
||||
"enter_hostname": "Bitte geben Sie eine IP-Adresse oder einen Hostenamen ein",
|
||||
"clients": "Clients"
|
||||
}
|
||||
@ -256,6 +256,7 @@ function show_statistics1()
|
||||
new getJSON("usage", "", show_statistics3);
|
||||
|
||||
g.main_nav_pos=2;
|
||||
g.settings_nav_pos=0;
|
||||
build_main_nav();
|
||||
}
|
||||
function show_statistics2(data)
|
||||
@ -264,17 +265,28 @@ function show_statistics2(data)
|
||||
if(g.main_nav_pos!=2) return;
|
||||
|
||||
var ndata="<a href=\"javascript: show_statistics1()\">"+trans["overview"]+"</a>";
|
||||
if(data.users.length>0)
|
||||
if(g.settings_nav_pos==0)
|
||||
{
|
||||
ndata+=" | ";
|
||||
ndata="<strong>"+trans["overview"]+"</strong>";
|
||||
}
|
||||
for(var i=0;i<data.users.length;++i)
|
||||
{
|
||||
ndata+=tmpls.stat_nav_pos.evaluate(data.users[i]);
|
||||
if(i+1<data.users.length)
|
||||
if(data.users.length>0)
|
||||
{
|
||||
ndata+=" | ";
|
||||
ndata+="<select size=\"1\" style=\"width: 150px\" onchange=\"stat_client()\" id=\"statclient\">";
|
||||
if(g.settings_nav_pos<1)
|
||||
{
|
||||
ndata+=" | ";
|
||||
ndata+="<option value=\"n\">"+trans["clients"]+"</option>";
|
||||
}
|
||||
for(var i=0;i<data.users.length;++i)
|
||||
{
|
||||
s="";
|
||||
if(g.settings_nav_pos==i+1)
|
||||
{
|
||||
s=" selected=\"selected\"";
|
||||
}
|
||||
ndata+="<option value=\""+i+"\""+s+">"+data.users[i].name+"</option>";
|
||||
}
|
||||
g.stat_data=data;
|
||||
}
|
||||
I('nav_pos').innerHTML=ndata;
|
||||
}
|
||||
@ -312,9 +324,18 @@ function stat_client(id, name)
|
||||
{
|
||||
if(g.main_nav_pos!=2) return;
|
||||
|
||||
g.data_f=tmpls.stat_user.evaluate({clientid: id, clientname: name, ses: g.session});
|
||||
I('data_f').innerHTML=g.data_f;
|
||||
new loadGraph("usagegraph", "clientid="+id, "usagegraph");
|
||||
var selidx=I('statclient').selectedIndex;
|
||||
if(selidx!=-1 && I('statclient').value!="n")
|
||||
{
|
||||
var idx=I('statclient').value*1;
|
||||
var name=g.stat_data.users[idx].name;
|
||||
var id=g.stat_data.users[idx].id;
|
||||
g.settings_nav_pos=idx+1;
|
||||
g.data_f=tmpls.stat_user.evaluate({clientid: id, clientname: name, ses: g.session});
|
||||
I('data_f').innerHTML=g.data_f;
|
||||
new loadGraph("usagegraph", "clientid="+id, "usagegraph");
|
||||
show_statistics2(g.stat_data);
|
||||
}
|
||||
}
|
||||
|
||||
function show_status1(details, hostname, remove)
|
||||
@ -687,20 +708,24 @@ function show_settings2(data)
|
||||
{
|
||||
g.settings_clients=nav.clients;
|
||||
|
||||
for(var i=0;i<nav.clients.length;++i)
|
||||
{
|
||||
if(n!="" ) n+=" | ";
|
||||
|
||||
if(g.settings_nav_pos==idx)
|
||||
if(nav.clients.length>0)
|
||||
{
|
||||
n+=" | ";
|
||||
n+="<select size=\"1\" style=\"width: 150px\" onchange=\"clientSettings()\" id=\"settingsclient\">";
|
||||
if(g.settings_nav_pos<idx)
|
||||
{
|
||||
n+="<strong>"+nav.clients[i].name+"</strong>";
|
||||
n+="<option value=\"n\">"+trans["clients"]+"</option>"
|
||||
}
|
||||
else
|
||||
{
|
||||
n+="<a href=\"javascript: clientSettings("+nav.clients[i].id+","+idx+")\">"+nav.clients[i].name+"</a>";
|
||||
for(var i=0;i<nav.clients.length;++i)
|
||||
{
|
||||
s="";
|
||||
if(g.settings_nav_pos==idx)
|
||||
{
|
||||
s=" selected=\"selected\"";
|
||||
}
|
||||
n+="<option value=\""+nav.clients[i].id+"-"+idx+"\""+s+">"+nav.clients[i].name+"</option>";
|
||||
++idx;
|
||||
}
|
||||
|
||||
++idx;
|
||||
}
|
||||
}
|
||||
I('nav_pos').innerHTML=n;
|
||||
@ -875,11 +900,17 @@ function saveGeneralSettings()
|
||||
}
|
||||
new getJSON("settings", "sa=general_save"+pars, show_settings2);
|
||||
}
|
||||
function clientSettings(clientid, idx)
|
||||
function clientSettings()
|
||||
{
|
||||
if(!startLoading()) return;
|
||||
g.settings_nav_pos=idx;
|
||||
new getJSON("settings", "sa=clientsettings&t_clientid="+clientid, show_settings2);
|
||||
var selidx=I('settingsclient').selectedIndex;
|
||||
if(selidx!=-1 && I('settingsclient').value!="n")
|
||||
{
|
||||
if(!startLoading()) return;
|
||||
clientid=I('settingsclient').value.split("-")[0];
|
||||
idx=clientid=I('settingsclient').value.split("-")[1];
|
||||
g.settings_nav_pos=idx*1;
|
||||
new getJSON("settings", "sa=clientsettings&t_clientid="+clientid, show_settings2);
|
||||
}
|
||||
}
|
||||
function generalSettings()
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user