mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
* src/web/ejabberd_web_admin.erl: Use textareas for large input
like ejabberd module options and listening port options. Show result of POST more clearly. Ensure access rules are shown with some minimum separation. Improve menu headers. (EJAB-562) * src/web/ejabberd_web_admin.hrl: Likewise * src/mod_offline.erl: Likewise * src/mod_offline_odbc.erl: Likewise * src/mod_roster.erl: Likewise * src/mod_roster_odbc.erl: Likewise * src/mod_shared_roster.erl: Likewise SVN Revision: 1813
This commit is contained in:
parent
ba2eb35590
commit
43a98ab69b
12
ChangeLog
12
ChangeLog
@ -1,5 +1,16 @@
|
|||||||
2009-01-12 Badlop <badlop@process-one.net>
|
2009-01-12 Badlop <badlop@process-one.net>
|
||||||
|
|
||||||
|
* src/web/ejabberd_web_admin.erl: Use textareas for large input
|
||||||
|
like ejabberd module options and listening port options. Show
|
||||||
|
result of POST more clearly. Ensure access rules are shown with
|
||||||
|
some minimum separation. Improve menu headers. (EJAB-562)
|
||||||
|
* src/web/ejabberd_web_admin.hrl: Likewise
|
||||||
|
* src/mod_offline.erl: Likewise
|
||||||
|
* src/mod_offline_odbc.erl: Likewise
|
||||||
|
* src/mod_roster.erl: Likewise
|
||||||
|
* src/mod_roster_odbc.erl: Likewise
|
||||||
|
* src/mod_shared_roster.erl: Likewise
|
||||||
|
|
||||||
* src/ejabberd_listener.erl: New way to configure IP address and
|
* src/ejabberd_listener.erl: New way to configure IP address and
|
||||||
IP version of listener. Support for definition of IP address in
|
IP version of listener. Support for definition of IP address in
|
||||||
string format, and implicit definition of IP
|
string format, and implicit definition of IP
|
||||||
@ -13,6 +24,7 @@
|
|||||||
* src/mod_proxy65/mod_proxy65_stream.erl: Likewise
|
* src/mod_proxy65/mod_proxy65_stream.erl: Likewise
|
||||||
* src/mod_proxy65/mod_proxy65_service.erl: Likewise
|
* src/mod_proxy65/mod_proxy65_service.erl: Likewise
|
||||||
* src/web/ejabberd_web_admin.erl: Likewise
|
* src/web/ejabberd_web_admin.erl: Likewise
|
||||||
|
|
||||||
* doc/guide.tex: Document the new way to configure IP address and
|
* doc/guide.tex: Document the new way to configure IP address and
|
||||||
IP version of listener, undocument options ip and inet6
|
IP version of listener, undocument options ip and inet6
|
||||||
* doc/guide.html: Likewise
|
* doc/guide.html: Likewise
|
||||||
|
@ -500,7 +500,7 @@ user_queue(User, Server, Query, Lang) ->
|
|||||||
[?XC("h1", io_lib:format(?T("~s's Offline Messages Queue"),
|
[?XC("h1", io_lib:format(?T("~s's Offline Messages Queue"),
|
||||||
[us_to_list(US)]))] ++
|
[us_to_list(US)]))] ++
|
||||||
case Res of
|
case Res of
|
||||||
ok -> [?CT("Submitted"), ?P];
|
ok -> [?XREST("Submitted")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||||
|
@ -358,7 +358,7 @@ user_queue(User, Server, Query, Lang) ->
|
|||||||
[?XC("h1", io_lib:format(?T("~s's Offline Messages Queue"),
|
[?XC("h1", io_lib:format(?T("~s's Offline Messages Queue"),
|
||||||
[us_to_list(US)]))] ++
|
[us_to_list(US)]))] ++
|
||||||
case Res of
|
case Res of
|
||||||
ok -> [?CT("Submitted"), ?P];
|
ok -> [?XREST("Submitted")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||||
|
@ -844,8 +844,8 @@ user_roster(User, Server, Query, Lang) ->
|
|||||||
end,
|
end,
|
||||||
[?XC("h1", ?T("Roster of ") ++ us_to_list(US))] ++
|
[?XC("h1", ?T("Roster of ") ++ us_to_list(US))] ++
|
||||||
case Res of
|
case Res of
|
||||||
ok -> [?CT("Submitted"), ?P];
|
ok -> [?XREST("Submitted")];
|
||||||
error -> [?CT("Bad format"), ?P];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||||
|
@ -944,8 +944,8 @@ user_roster(User, Server, Query, Lang) ->
|
|||||||
end,
|
end,
|
||||||
[?XC("h1", ?T("Roster of ") ++ us_to_list(US))] ++
|
[?XC("h1", ?T("Roster of ") ++ us_to_list(US))] ++
|
||||||
case Res of
|
case Res of
|
||||||
ok -> [?CT("Submitted"), ?P];
|
ok -> [?XREST("Submitted")];
|
||||||
error -> [?CT("Bad format"), ?P];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||||
|
@ -725,8 +725,8 @@ list_shared_roster_groups(Host, Query, Lang) ->
|
|||||||
)]),
|
)]),
|
||||||
?H1GL(?T("Shared Roster Groups"), "modsharedroster", "mod_shared_roster") ++
|
?H1GL(?T("Shared Roster Groups"), "modsharedroster", "mod_shared_roster") ++
|
||||||
case Res of
|
case Res of
|
||||||
ok -> [?CT("Submitted"), ?P];
|
ok -> [?XREST("Submitted")];
|
||||||
error -> [?CT("Bad format"), ?P];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||||
@ -789,8 +789,9 @@ shared_roster_group(Host, Group, Query, Lang) ->
|
|||||||
[]
|
[]
|
||||||
end ++ [[us_to_list(Member), $\n] || Member <- Members],
|
end ++ [[us_to_list(Member), $\n] || Member <- Members],
|
||||||
FDisplayedGroups = [[DG, $\n] || DG <- DisplayedGroups],
|
FDisplayedGroups = [[DG, $\n] || DG <- DisplayedGroups],
|
||||||
|
DescNL = length(element(2, regexp:split(Description, "\n"))),
|
||||||
FGroup =
|
FGroup =
|
||||||
?XAE("table", [],
|
?XAE("table", [{"class", "withtextareas"}],
|
||||||
[?XE("tbody",
|
[?XE("tbody",
|
||||||
[?XE("tr",
|
[?XE("tr",
|
||||||
[?XCT("td", "Name:"),
|
[?XCT("td", "Name:"),
|
||||||
@ -799,34 +800,34 @@ shared_roster_group(Host, Group, Query, Lang) ->
|
|||||||
),
|
),
|
||||||
?XE("tr",
|
?XE("tr",
|
||||||
[?XCT("td", "Description:"),
|
[?XCT("td", "Description:"),
|
||||||
?XE("td", [?XAC("textarea", [{"name", "description"},
|
?XE("td", [
|
||||||
{"rows", "3"},
|
?TEXTAREA("description", integer_to_list(lists:max([3, DescNL])), "20", Description)
|
||||||
{"cols", "20"}],
|
]
|
||||||
Description)])
|
)
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
?XE("tr",
|
?XE("tr",
|
||||||
[?XCT("td", "Members:"),
|
[?XCT("td", "Members:"),
|
||||||
?XE("td", [?XAC("textarea", [{"name", "members"},
|
?XE("td", [
|
||||||
{"rows", "3"},
|
?TEXTAREA("members", integer_to_list(lists:max([3, length(FMembers)])), "20", FMembers)
|
||||||
{"cols", "20"}],
|
]
|
||||||
FMembers)])
|
)
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
?XE("tr",
|
?XE("tr",
|
||||||
[?XCT("td", "Displayed Groups:"),
|
[?XCT("td", "Displayed Groups:"),
|
||||||
?XE("td", [?XAC("textarea", [{"name", "dispgroups"},
|
?XE("td", [
|
||||||
{"rows", "3"},
|
?TEXTAREA("dispgroups", integer_to_list(lists:max([3, length(FDisplayedGroups)])), "20", FDisplayedGroups)
|
||||||
{"cols", "20"}],
|
]
|
||||||
FDisplayedGroups)])
|
)
|
||||||
]
|
]
|
||||||
)]
|
)]
|
||||||
)]),
|
)]),
|
||||||
?H1GL(?T("Shared Roster Groups"), "modsharedroster", "mod_shared_roster") ++
|
?H1GL(?T("Shared Roster Groups"), "modsharedroster", "mod_shared_roster") ++
|
||||||
[?XC("h2", ?T("Group ") ++ Group)] ++
|
[?XC("h2", ?T("Group ") ++ Group)] ++
|
||||||
case Res of
|
case Res of
|
||||||
ok -> [?CT("Submitted"), ?P];
|
ok -> [?XREST("Submitted")];
|
||||||
error -> [?CT("Bad format"), ?P];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||||
|
@ -157,7 +157,7 @@ make_xhtml(Els, Host, Node, Lang) ->
|
|||||||
[?XAE("div",
|
[?XAE("div",
|
||||||
[{"id", "header"}],
|
[{"id", "header"}],
|
||||||
[?XE("h1",
|
[?XE("h1",
|
||||||
[?ACT("/admin/", "Administration")]
|
[?ACT("/admin/", "ejabberd Web Admin")]
|
||||||
)]),
|
)]),
|
||||||
?XAE("div",
|
?XAE("div",
|
||||||
[{"id", "navigation"}],
|
[{"id", "navigation"}],
|
||||||
@ -312,6 +312,7 @@ ul li #navhead a, ul li #navheadsub a, ul li #navheadsubsub a {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
border-top: 2px solid #d47911;
|
border-top: 2px solid #d47911;
|
||||||
border-bottom: 1px solid #d47911;
|
border-bottom: 1px solid #d47911;
|
||||||
|
background: #FED6A6;
|
||||||
}
|
}
|
||||||
|
|
||||||
#navheadsub, #navitemsub {
|
#navheadsub, #navitemsub {
|
||||||
@ -367,10 +368,6 @@ textarea {
|
|||||||
border: 1px solid #d6760e;
|
border: 1px solid #d6760e;
|
||||||
color: #723202;
|
color: #723202;
|
||||||
background-color: #fff2e8;
|
background-color: #fff2e8;
|
||||||
vertical-align: middle;
|
|
||||||
margin-top: 7px;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
padding: 0.1em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
@ -538,6 +535,19 @@ div.guidelink {
|
|||||||
padding-right: 1em;
|
padding-right: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table.withtextareas>tbody>tr>td {
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.result {
|
||||||
|
border: 1px;
|
||||||
|
border-style: dashed;
|
||||||
|
border-color: #FE8A02;
|
||||||
|
padding: 1em;
|
||||||
|
margin-right: 1em;
|
||||||
|
background: #FFE3C9;
|
||||||
|
}
|
||||||
|
|
||||||
*.alignright {
|
*.alignright {
|
||||||
font-size: 10pt;
|
font-size: 10pt;
|
||||||
}
|
}
|
||||||
@ -633,6 +643,7 @@ process_admin(Host,
|
|||||||
#request{path = ["acls-raw"],
|
#request{path = ["acls-raw"],
|
||||||
q = Query,
|
q = Query,
|
||||||
lang = Lang}) ->
|
lang = Lang}) ->
|
||||||
|
|
||||||
Res = case lists:keysearch("acls", 1, Query) of
|
Res = case lists:keysearch("acls", 1, Query) of
|
||||||
{value, {_, String}} ->
|
{value, {_, String}} ->
|
||||||
case erl_scan:string(String) of
|
case erl_scan:string(String) of
|
||||||
@ -654,22 +665,17 @@ process_admin(Host,
|
|||||||
_ ->
|
_ ->
|
||||||
nothing
|
nothing
|
||||||
end,
|
end,
|
||||||
ACLs = lists:flatten(
|
ACLs = lists:keysort(2, ets:select(acl, [{{acl, {'$1', Host}, '$2'},
|
||||||
io_lib:format(
|
[], [{{acl, '$1', '$2'}}]}])),
|
||||||
"~p.", [lists:keysort(
|
{NumLines, ACLsP} = term_to_paragraph(ACLs, 80),
|
||||||
2, ets:select(acl, [{{acl, {'$1', Host}, '$2'},
|
|
||||||
[], [{{acl, '$1', '$2'}}]}]))])),
|
|
||||||
make_xhtml(?H1GL(?T("Access Control Lists"), "ACLDefinition", "ACL Definition") ++
|
make_xhtml(?H1GL(?T("Access Control Lists"), "ACLDefinition", "ACL Definition") ++
|
||||||
case Res of
|
case Res of
|
||||||
ok -> [?CT("Submitted"), ?P];
|
ok -> [?XREST("Submitted")];
|
||||||
error -> [?CT("Bad format"), ?P];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||||
[?XAC("textarea", [{"name", "acls"},
|
[?TEXTAREA("acls", integer_to_list(lists:max([16, NumLines])), "80", ACLsP++"."),
|
||||||
{"rows", "16"},
|
|
||||||
{"cols", "80"}],
|
|
||||||
ACLs),
|
|
||||||
?BR,
|
?BR,
|
||||||
?INPUTT("submit", "submit", "Submit")
|
?INPUTT("submit", "submit", "Submit")
|
||||||
])
|
])
|
||||||
@ -704,8 +710,8 @@ process_admin(Host,
|
|||||||
[], [{{acl, '$1', '$2'}}]}])),
|
[], [{{acl, '$1', '$2'}}]}])),
|
||||||
make_xhtml(?H1GL(?T("Access Control Lists"), "ACLDefinition", "ACL Definition") ++
|
make_xhtml(?H1GL(?T("Access Control Lists"), "ACLDefinition", "ACL Definition") ++
|
||||||
case Res of
|
case Res of
|
||||||
ok -> [?CT("Submitted"), ?P];
|
ok -> [?XREST("Submitted")];
|
||||||
error -> [?CT("Bad format"), ?P];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XE("p", [?ACT("../acls-raw/", "Raw")])] ++
|
[?XE("p", [?ACT("../acls-raw/", "Raw")])] ++
|
||||||
@ -764,23 +770,19 @@ process_admin(Host,
|
|||||||
nothing
|
nothing
|
||||||
end,
|
end,
|
||||||
Access =
|
Access =
|
||||||
lists:flatten(
|
ets:select(config,
|
||||||
io_lib:format(
|
|
||||||
"~p.", [ets:select(config,
|
|
||||||
[{{config, {access, '$1', Host}, '$2'},
|
[{{config, {access, '$1', Host}, '$2'},
|
||||||
[],
|
[],
|
||||||
[{{access, '$1', '$2'}}]}])])),
|
[{{access, '$1', '$2'}}]}]),
|
||||||
|
{NumLines, AccessP} = term_to_paragraph(Access, 80),
|
||||||
make_xhtml(?H1GL(?T("Access Rules"), "AccessRights", "Access Rights") ++
|
make_xhtml(?H1GL(?T("Access Rules"), "AccessRights", "Access Rights") ++
|
||||||
case Res of
|
case Res of
|
||||||
ok -> [?CT("Submitted"), ?P];
|
ok -> [?XREST("Submitted")];
|
||||||
error -> [?CT("Bad format"), ?P];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||||
[?XAC("textarea", [{"name", "access"},
|
[?TEXTAREA("access", integer_to_list(lists:max([16, NumLines])), "80", AccessP++"."),
|
||||||
{"rows", "16"},
|
|
||||||
{"cols", "80"}],
|
|
||||||
Access),
|
|
||||||
?BR,
|
?BR,
|
||||||
?INPUTT("submit", "submit", "Submit")
|
?INPUTT("submit", "submit", "Submit")
|
||||||
])
|
])
|
||||||
@ -810,8 +812,8 @@ process_admin(Host,
|
|||||||
[{{access, '$1', '$2'}}]}]),
|
[{{access, '$1', '$2'}}]}]),
|
||||||
make_xhtml(?H1GL(?T("Access Rules"), "AccessRights", "Access Rights") ++
|
make_xhtml(?H1GL(?T("Access Rules"), "AccessRights", "Access Rights") ++
|
||||||
case Res of
|
case Res of
|
||||||
ok -> [?CT("Submitted"), ?P];
|
ok -> [?XREST("Submitted")];
|
||||||
error -> [?CT("Bad format"), ?P];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XE("p", [?ACT("../access-raw/", "Raw")])] ++
|
[?XE("p", [?ACT("../access-raw/", "Raw")])] ++
|
||||||
@ -850,8 +852,8 @@ process_admin(Host,
|
|||||||
make_xhtml([?XC("h1",
|
make_xhtml([?XC("h1",
|
||||||
io_lib:format(?T("~s access rule configuration"), [SName]))] ++
|
io_lib:format(?T("~s access rule configuration"), [SName]))] ++
|
||||||
case Res of
|
case Res of
|
||||||
ok -> [?CT("Submitted"), ?P];
|
ok -> [?XREST("Submitted")];
|
||||||
error -> [?CT("Bad format"), ?P];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||||
@ -1054,12 +1056,20 @@ acl_spec_select(ID, Opt) ->
|
|||||||
node_regexp, user_glob, server_glob, node_glob, all, raw]))]).
|
node_regexp, user_glob, server_glob, node_glob, all, raw]))]).
|
||||||
|
|
||||||
|
|
||||||
|
%% @spec (T::any()) -> StringLine::string()
|
||||||
term_to_string(T) ->
|
term_to_string(T) ->
|
||||||
StringParagraph = lists:flatten(io_lib:format("~1000000p", [T])),
|
StringParagraph = lists:flatten(io_lib:format("~1000000p", [T])),
|
||||||
%% Remove from the string all the carriage returns characters
|
%% Remove from the string all the carriage returns characters
|
||||||
{ok, StringLine, _} = regexp:gsub(StringParagraph, "\\n ", ""),
|
{ok, StringLine, _} = regexp:gsub(StringParagraph, "\\n ", ""),
|
||||||
StringLine.
|
StringLine.
|
||||||
|
|
||||||
|
%% @spec (T::any()) -> {NumLines::integer(), Paragraph::string()}
|
||||||
|
term_to_paragraph(T, Cols) ->
|
||||||
|
Paragraph = erl_prettypr:format(erl_syntax:abstract(T), [{paper, Cols}]),
|
||||||
|
{ok, FieldList} = regexp:split(Paragraph, "\n"),
|
||||||
|
NumLines = length(FieldList),
|
||||||
|
{NumLines, Paragraph}.
|
||||||
|
|
||||||
term_to_id(T) ->
|
term_to_id(T) ->
|
||||||
jlib:encode_base64(binary_to_list(term_to_binary(T))).
|
jlib:encode_base64(binary_to_list(term_to_binary(T))).
|
||||||
|
|
||||||
@ -1227,7 +1237,7 @@ access_rule_to_xhtml(Rules) ->
|
|||||||
fun({Access, ACL} = _Rule) ->
|
fun({Access, ACL} = _Rule) ->
|
||||||
SAccess = element_to_list(Access),
|
SAccess = element_to_list(Access),
|
||||||
SACL = atom_to_list(ACL),
|
SACL = atom_to_list(ACL),
|
||||||
SAccess ++ "\t" ++ SACL ++ "\n"
|
SAccess ++ "\s\t" ++ SACL ++ "\n"
|
||||||
end, Rules),
|
end, Rules),
|
||||||
?XAC("textarea", [{"name", "rules"},
|
?XAC("textarea", [{"name", "rules"},
|
||||||
{"rows", "16"},
|
{"rows", "16"},
|
||||||
@ -1304,8 +1314,8 @@ list_users(Host, Query, Lang, URLFunc) ->
|
|||||||
end, lists:seq(1, N, M))
|
end, lists:seq(1, N, M))
|
||||||
end,
|
end,
|
||||||
case Res of
|
case Res of
|
||||||
ok -> [?CT("Submitted"), ?P];
|
ok -> [?XREST("Submitted")];
|
||||||
error -> [?CT("Bad format"), ?P];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||||
@ -1500,8 +1510,8 @@ user_info(User, Server, Query, Lang) ->
|
|||||||
[User, Server, Lang]),
|
[User, Server, Lang]),
|
||||||
[?XC("h1", ?T("User ") ++ us_to_list(US))] ++
|
[?XC("h1", ?T("User ") ++ us_to_list(US))] ++
|
||||||
case Res of
|
case Res of
|
||||||
ok -> [?CT("Submitted"), ?P];
|
ok -> [?XREST("Submitted")];
|
||||||
error -> [?CT("Bad format"), ?P];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||||
@ -1668,8 +1678,8 @@ get_node(global, Node, [], Query, Lang) ->
|
|||||||
MenuItems2 = make_menu_items(global, Node, Base, Lang),
|
MenuItems2 = make_menu_items(global, Node, Base, Lang),
|
||||||
[?XC("h1", ?T("Node ") ++ atom_to_list(Node))] ++
|
[?XC("h1", ?T("Node ") ++ atom_to_list(Node))] ++
|
||||||
case Res of
|
case Res of
|
||||||
ok -> [?CT("Submitted"), ?P];
|
ok -> [?XREST("Submitted")];
|
||||||
error -> [?CT("Bad format"), ?P];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XE("ul",
|
[?XE("ul",
|
||||||
@ -1698,7 +1708,10 @@ get_node(global, Node, ["db"], Query, Lang) ->
|
|||||||
{badrpc, _Reason} ->
|
{badrpc, _Reason} ->
|
||||||
[?XCT("h1", "RPC Call Error")];
|
[?XCT("h1", "RPC Call Error")];
|
||||||
Tables ->
|
Tables ->
|
||||||
node_db_parse_query(Node, Tables, Query),
|
ResS = case node_db_parse_query(Node, Tables, Query) of
|
||||||
|
nothing -> [];
|
||||||
|
ok -> [?XREST("Submitted")]
|
||||||
|
end,
|
||||||
STables = lists:sort(Tables),
|
STables = lists:sort(Tables),
|
||||||
Rows = lists:map(
|
Rows = lists:map(
|
||||||
fun(Table) ->
|
fun(Table) ->
|
||||||
@ -1735,7 +1748,7 @@ get_node(global, Node, ["db"], Query, Lang) ->
|
|||||||
])
|
])
|
||||||
end, STables),
|
end, STables),
|
||||||
[?XC("h1", ?T("Database Tables at ") ++ atom_to_list(Node))] ++
|
[?XC("h1", ?T("Database Tables at ") ++ atom_to_list(Node))] ++
|
||||||
[?CT("Submitted"), ?P] ++
|
ResS ++
|
||||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||||
[?XAE("table", [],
|
[?XAE("table", [],
|
||||||
[?XE("thead",
|
[?XE("thead",
|
||||||
@ -1757,9 +1770,14 @@ get_node(global, Node, ["db"], Query, Lang) ->
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
get_node(global, Node, ["backup"], Query, Lang) ->
|
get_node(global, Node, ["backup"], Query, Lang) ->
|
||||||
_Res = node_backup_parse_query(Node, Query),
|
ResS = case node_backup_parse_query(Node, Query) of
|
||||||
[?XC("h1", ?T("Backup of ") ++ atom_to_list(Node)),
|
nothing -> [];
|
||||||
?XCT("p", "Remark that these options will only backup the builtin Mnesia database. If you are using the ODBC module, you also need to backup your SQL database separately."),
|
ok -> [?XREST("Submitted")];
|
||||||
|
{error, Error} -> [?XRES(?T("Error") ++": " ++ io_lib:format("~p", [Error]))]
|
||||||
|
end,
|
||||||
|
[?XC("h1", ?T("Backup of ") ++ atom_to_list(Node))] ++
|
||||||
|
ResS ++
|
||||||
|
[?XCT("p", "Remark that these options will only backup the builtin Mnesia database. If you are using the ODBC module, you also need to backup your SQL database separately."),
|
||||||
?XAE("form", [{"action", ""}, {"method", "post"}],
|
?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||||
[?XAE("table", [],
|
[?XAE("table", [],
|
||||||
[?XE("tbody",
|
[?XE("tbody",
|
||||||
@ -1822,9 +1840,9 @@ get_node(global, Node, ["ports"], Query, Lang) ->
|
|||||||
H1String = ?T("Listened Ports at ") ++ atom_to_list(Node),
|
H1String = ?T("Listened Ports at ") ++ atom_to_list(Node),
|
||||||
?H1GL(H1String, "listened", "Listening Ports") ++
|
?H1GL(H1String, "listened", "Listening Ports") ++
|
||||||
case Res of
|
case Res of
|
||||||
ok -> [?CT("Submitted"), ?P];
|
ok -> [?XREST("Submitted")];
|
||||||
error -> [?CT("Bad format"), ?P];
|
error -> [?XREST("Bad format")];
|
||||||
{error, ReasonT} -> [?CT("Problem: "), ?C(ReasonT), ?P];
|
{error, ReasonT} -> [?XRES(?T("Error") ++ ": " ++ ReasonT)];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||||
@ -1847,8 +1865,8 @@ get_node(Host, Node, ["modules"], Query, Lang) when is_list(Host) ->
|
|||||||
H1String = ?T("Modules at ") ++ atom_to_list(Node),
|
H1String = ?T("Modules at ") ++ atom_to_list(Node),
|
||||||
?H1GL(H1String, "modoverview", "Modules Overview") ++
|
?H1GL(H1String, "modoverview", "Modules Overview") ++
|
||||||
case Res of
|
case Res of
|
||||||
ok -> [?CT("Submitted"), ?P];
|
ok -> [?XREST("Submitted")];
|
||||||
error -> [?CT("Bad format"), ?P];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||||
@ -1916,17 +1934,19 @@ get_node(global, Node, ["update"], Query, Lang) ->
|
|||||||
FmtLowLevelScript = ?XC("pre", io_lib:format("~p", [LowLevelScript])),
|
FmtLowLevelScript = ?XC("pre", io_lib:format("~p", [LowLevelScript])),
|
||||||
[?XC("h1", ?T("Update ") ++ atom_to_list(Node))] ++
|
[?XC("h1", ?T("Update ") ++ atom_to_list(Node))] ++
|
||||||
case Res of
|
case Res of
|
||||||
ok -> [?CT("Submitted"), ?P];
|
ok -> [?XREST("Submitted")];
|
||||||
error -> [?CT("Bad format"), ?P];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
[?XAE("form", [{"action", ""}, {"method", "post"}],
|
||||||
[?INPUTT("submit", "update", "Update"),
|
[
|
||||||
?XCT("h2", "Update plan"),
|
?XCT("h2", "Update plan"),
|
||||||
?XCT("h3", "Updated modules"), Mods,
|
?XCT("h3", "Modified modules"), Mods,
|
||||||
?XCT("h3", "Update script"), FmtScript,
|
?XCT("h3", "Update script"), FmtScript,
|
||||||
?XCT("h3", "Low level update script"), FmtLowLevelScript,
|
?XCT("h3", "Low level update script"), FmtLowLevelScript,
|
||||||
?XCT("h3", "Script check"), ?C(atom_to_list(Check))])
|
?XCT("h3", "Script check"), ?XC("pre", atom_to_list(Check)),
|
||||||
|
?INPUTT("submit", "update", "Update")
|
||||||
|
])
|
||||||
];
|
];
|
||||||
|
|
||||||
get_node(Host, Node, NPath, Query, Lang) ->
|
get_node(Host, Node, NPath, Query, Lang) ->
|
||||||
@ -1981,6 +2001,8 @@ db_storage_select(ID, Opt, Lang) ->
|
|||||||
{disc_only_copies, "Disc only copy"},
|
{disc_only_copies, "Disc only copy"},
|
||||||
{unknown, "Remote copy"}])).
|
{unknown, "Remote copy"}])).
|
||||||
|
|
||||||
|
node_db_parse_query(_Node, _Tables, [{nokey,[]}]) ->
|
||||||
|
nothing;
|
||||||
node_db_parse_query(Node, Tables, Query) ->
|
node_db_parse_query(Node, Tables, Query) ->
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun(Table) ->
|
fun(Table) ->
|
||||||
@ -2014,6 +2036,8 @@ node_db_parse_query(Node, Tables, Query) ->
|
|||||||
end, Tables),
|
end, Tables),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
node_backup_parse_query(_Node, [{nokey,[]}]) ->
|
||||||
|
nothing;
|
||||||
node_backup_parse_query(Node, Query) ->
|
node_backup_parse_query(Node, Query) ->
|
||||||
lists:foldl(
|
lists:foldl(
|
||||||
fun(Action, nothing) ->
|
fun(Action, nothing) ->
|
||||||
@ -2040,15 +2064,15 @@ node_backup_parse_query(Node, Query) ->
|
|||||||
load_textfile, [Path])
|
load_textfile, [Path])
|
||||||
end,
|
end,
|
||||||
case Res of
|
case Res of
|
||||||
{error, _Reason} ->
|
{error, Reason} ->
|
||||||
error;
|
{error, Reason};
|
||||||
{badrpc, _Reason} ->
|
{badrpc, Reason} ->
|
||||||
error;
|
{badrpc, Reason};
|
||||||
_ ->
|
_ ->
|
||||||
ok
|
ok
|
||||||
end;
|
end;
|
||||||
_ ->
|
OtherError ->
|
||||||
error
|
{error, OtherError}
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
nothing
|
nothing
|
||||||
@ -2059,7 +2083,7 @@ node_backup_parse_query(Node, Query) ->
|
|||||||
|
|
||||||
|
|
||||||
node_ports_to_xhtml(Ports, Lang) ->
|
node_ports_to_xhtml(Ports, Lang) ->
|
||||||
?XAE("table", [],
|
?XAE("table", [{"class", "withtextareas"}],
|
||||||
[?XE("thead",
|
[?XE("thead",
|
||||||
[?XE("tr",
|
[?XE("tr",
|
||||||
[?XCT("td", "Port"),
|
[?XCT("td", "Port"),
|
||||||
@ -2073,14 +2097,14 @@ node_ports_to_xhtml(Ports, Lang) ->
|
|||||||
{_Port, SPort, _TIP, SIP, SSPort, OptsClean} =
|
{_Port, SPort, _TIP, SIP, SSPort, OptsClean} =
|
||||||
get_port_data(PortIP, Opts),
|
get_port_data(PortIP, Opts),
|
||||||
SModule = atom_to_list(Module),
|
SModule = atom_to_list(Module),
|
||||||
|
{NumLines, SOptsClean} = term_to_paragraph(OptsClean, 40),
|
||||||
%%ID = term_to_id(E),
|
%%ID = term_to_id(E),
|
||||||
?XE("tr",
|
?XE("tr",
|
||||||
[?XAE("td", [{"size", "6"}], [?C(SPort)]),
|
[?XAE("td", [{"size", "6"}], [?C(SPort)]),
|
||||||
?XAE("td", [{"size", "15"}], [?C(SIP)]),
|
?XAE("td", [{"size", "15"}], [?C(SIP)]),
|
||||||
?XE("td", [?INPUTS("text", "module" ++ SSPort,
|
?XE("td", [?INPUTS("text", "module" ++ SSPort,
|
||||||
SModule, "15")]),
|
SModule, "15")]),
|
||||||
?XE("td", [?INPUTS("text", "opts" ++ SSPort,
|
?XE("td", [?TEXTAREA("opts" ++ SSPort, integer_to_list(NumLines), "35", SOptsClean)]),
|
||||||
term_to_string(OptsClean), "40")]),
|
|
||||||
?XE("td", [?INPUTT("submit", "add" ++ SSPort,
|
?XE("td", [?INPUTT("submit", "add" ++ SSPort,
|
||||||
"Update")]),
|
"Update")]),
|
||||||
?XE("td", [?INPUTT("submit", "delete" ++ SSPort,
|
?XE("td", [?INPUTT("submit", "delete" ++ SSPort,
|
||||||
@ -2091,8 +2115,8 @@ node_ports_to_xhtml(Ports, Lang) ->
|
|||||||
[?XE("tr",
|
[?XE("tr",
|
||||||
[?XE("td", [?INPUTS("text", "portnew", "", "6")]),
|
[?XE("td", [?INPUTS("text", "portnew", "", "6")]),
|
||||||
?XE("td", [?INPUTS("text", "ipnew", "0.0.0.0", "15")]),
|
?XE("td", [?INPUTS("text", "ipnew", "0.0.0.0", "15")]),
|
||||||
?XE("td", [?INPUTS("text", "modulenew", "", "17")]),
|
?XE("td", [?INPUTS("text", "modulenew", "", "15")]),
|
||||||
?XE("td", [?INPUTS("text", "optsnew", "[]", "40")]),
|
?XE("td", [?TEXTAREA("optsnew", "2", "35", "[]")]),
|
||||||
?XAE("td", [{"colspan", "2"}],
|
?XAE("td", [{"colspan", "2"}],
|
||||||
[?INPUTT("submit", "addnew", "Add New")])
|
[?INPUTT("submit", "addnew", "Add New")])
|
||||||
]
|
]
|
||||||
@ -2170,7 +2194,7 @@ node_ports_parse_query(Node, Ports, Query) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
node_modules_to_xhtml(Modules, Lang) ->
|
node_modules_to_xhtml(Modules, Lang) ->
|
||||||
?XAE("table", [],
|
?XAE("table", [{"class", "withtextareas"}],
|
||||||
[?XE("thead",
|
[?XE("thead",
|
||||||
[?XE("tr",
|
[?XE("tr",
|
||||||
[?XCT("td", "Module"),
|
[?XCT("td", "Module"),
|
||||||
@ -2180,11 +2204,11 @@ node_modules_to_xhtml(Modules, Lang) ->
|
|||||||
lists:map(
|
lists:map(
|
||||||
fun({Module, Opts} = _E) ->
|
fun({Module, Opts} = _E) ->
|
||||||
SModule = atom_to_list(Module),
|
SModule = atom_to_list(Module),
|
||||||
|
{NumLines, SOpts} = term_to_paragraph(Opts, 40),
|
||||||
%%ID = term_to_id(E),
|
%%ID = term_to_id(E),
|
||||||
?XE("tr",
|
?XE("tr",
|
||||||
[?XC("td", SModule),
|
[?XC("td", SModule),
|
||||||
?XE("td", [?INPUTS("text", "opts" ++ SModule,
|
?XE("td", [?TEXTAREA("opts" ++ SModule, integer_to_list(NumLines), "40", SOpts)]),
|
||||||
term_to_string(Opts), "40")]),
|
|
||||||
?XE("td", [?INPUTT("submit", "restart" ++ SModule,
|
?XE("td", [?INPUTT("submit", "restart" ++ SModule,
|
||||||
"Restart")]),
|
"Restart")]),
|
||||||
?XE("td", [?INPUTT("submit", "stop" ++ SModule,
|
?XE("td", [?INPUTT("submit", "stop" ++ SModule,
|
||||||
@ -2194,7 +2218,7 @@ node_modules_to_xhtml(Modules, Lang) ->
|
|||||||
end, Modules) ++
|
end, Modules) ++
|
||||||
[?XE("tr",
|
[?XE("tr",
|
||||||
[?XE("td", [?INPUT("text", "modulenew", "")]),
|
[?XE("td", [?INPUT("text", "modulenew", "")]),
|
||||||
?XE("td", [?INPUTS("text", "optsnew", "", "40")]),
|
?XE("td", [?TEXTAREA("optsnew", "2", "40", "[]")]),
|
||||||
?XAE("td", [{"colspan", "2"}],
|
?XAE("td", [{"colspan", "2"}],
|
||||||
[?INPUTT("submit", "start", "Start")])
|
[?INPUTT("submit", "start", "Start")])
|
||||||
]
|
]
|
||||||
@ -2437,11 +2461,11 @@ make_menu_items2(Lang, Deep, {MURI, MName, [Item | Items]}, Res) ->
|
|||||||
make_menu_items2(Lang, Deep, {MURI, MName, Items}, Res2).
|
make_menu_items2(Lang, Deep, {MURI, MName, Items}, Res2).
|
||||||
|
|
||||||
make_menu_item(header, 1, URI, Name, _Lang) ->
|
make_menu_item(header, 1, URI, Name, _Lang) ->
|
||||||
?LI([?XAE("div", [{"id", "navhead"}], [?AC(URI, "~ "++Name++" ~")] )]);
|
?LI([?XAE("div", [{"id", "navhead"}], [?AC(URI, Name)] )]);
|
||||||
make_menu_item(header, 2, URI, Name, _Lang) ->
|
make_menu_item(header, 2, URI, Name, _Lang) ->
|
||||||
?LI([?XAE("div", [{"id", "navheadsub"}], [?AC(URI, "~ "++Name++" ~")] )]);
|
?LI([?XAE("div", [{"id", "navheadsub"}], [?AC(URI, Name)] )]);
|
||||||
make_menu_item(header, 3, URI, Name, _Lang) ->
|
make_menu_item(header, 3, URI, Name, _Lang) ->
|
||||||
?LI([?XAE("div", [{"id", "navheadsubsub"}], [?AC(URI, "~ "++Name++" ~")] )]);
|
?LI([?XAE("div", [{"id", "navheadsubsub"}], [?AC(URI, Name)] )]);
|
||||||
make_menu_item(item, 1, URI, Name, Lang) ->
|
make_menu_item(item, 1, URI, Name, Lang) ->
|
||||||
?LI([?XAE("div", [{"id", "navitem"}], [?ACT(URI, Name)] )]);
|
?LI([?XAE("div", [{"id", "navitem"}], [?ACT(URI, Name)] )]);
|
||||||
make_menu_item(item, 2, URI, Name, Lang) ->
|
make_menu_item(item, 2, URI, Name, Lang) ->
|
||||||
|
@ -51,6 +51,16 @@
|
|||||||
-define(INPUTST(Type, Name, Value, Size), ?INPUT(Type, Name, ?T(Value), Size)).
|
-define(INPUTST(Type, Name, Value, Size), ?INPUT(Type, Name, ?T(Value), Size)).
|
||||||
-define(ACLINPUT(Text), ?XE("td", [?INPUT("text", "value" ++ ID, Text)])).
|
-define(ACLINPUT(Text), ?XE("td", [?INPUT("text", "value" ++ ID, Text)])).
|
||||||
|
|
||||||
|
-define(TEXTAREA(Name, Rows, Cols, Value),
|
||||||
|
?XAC("textarea", [{"name", Name},
|
||||||
|
{"rows", Rows},
|
||||||
|
{"cols", Cols}],
|
||||||
|
Value)).
|
||||||
|
|
||||||
|
%% Build an xmlelement for result
|
||||||
|
-define(XRES(Text), ?XAC("p", [{"class", "result"}], Text)).
|
||||||
|
-define(XREST(Text), ?XRES(?T(Text))).
|
||||||
|
|
||||||
%% Guide Link
|
%% Guide Link
|
||||||
-define(GL(Ref, Title),
|
-define(GL(Ref, Title),
|
||||||
?XAE("div",
|
?XAE("div",
|
||||||
|
Loading…
Reference in New Issue
Block a user