diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | doc/guide.html | 12 | ||||
-rw-r--r-- | doc/guide.tex | 12 | ||||
-rw-r--r-- | src/mod_shared_roster.erl | 4 | ||||
-rw-r--r-- | src/web/ejabberd_web_admin.erl | 51 | ||||
-rw-r--r-- | src/web/ejabberd_web_admin.hrl | 14 |
6 files changed, 90 insertions, 13 deletions
@@ -1,3 +1,13 @@ +2009-01-07 Badlop <badlop@process-one.net> + + * src/web/ejabberd_web_admin.erl: WebAdmin serves Guide and links + to related sections; the path to guide.html can be configured with + option doc_path (EJAB-837) + * src/web/ejabberd_web_admin.hrl: Likewise + * src/mod_shared_roster.erl: Likewise + * doc/guide.tex: Likewise + * doc/guide.html: Likewise + 2009-01-06 Badlop <badlop@process-one.net> * src/msgs/ru.po: Fix typo (thanks to Dominges) diff --git a/doc/guide.html b/doc/guide.html index 6d143c335..b7466955e 100644 --- a/doc/guide.html +++ b/doc/guide.html @@ -3072,7 +3072,17 @@ web browser to <CODE>https://192.168.1.1:5280/admin/</CODE>: tls, {certfile, "/usr/local/etc/server.pem"}]}, ... ]}. -</PRE></LI></UL><P> <A NAME="adhoccommands"></A> </P><!--TOC section Ad-hoc Commands--> +</PRE></LI></UL><P>Certain pages in the ejabberd Web Admin contain a link to a related +section in the ejabberd Installation and Operation Guide. +In order to view such links, a copy in HTML format of the Guide must +be installed in the system. +The file is searched by default in +<TT>"/share/doc/ejabberd/guide.html"</TT>. +The directory of the documentation can be specified in +<TT>ejabberd.cfg</TT> with the option <TT>doc_path</TT>. +For example: +</P><PRE CLASS="verbatim">{doc_path, "/usr/local/share/doc/ejabberd/"}. +</PRE><P> <A NAME="adhoccommands"></A> </P><!--TOC section Ad-hoc Commands--> <H2 CLASS="section"><!--SEC ANCHOR --><A NAME="htoc65">4.3</A>  <A HREF="#adhoccommands">Ad-hoc Commands</A></H2><!--SEC END --><P> <A NAME="adhoccommands"></A> </P><P>If you enable <TT>mod_configure</TT> and <TT>mod_adhoc</TT>, you can perform several administrative tasks in <TT>ejabberd</TT> with a Jabber client. diff --git a/doc/guide.tex b/doc/guide.tex index afc63a3ff..c3fb6db07 100644 --- a/doc/guide.tex +++ b/doc/guide.tex @@ -3943,6 +3943,18 @@ Examples: \end{verbatim} \end{itemize} +Certain pages in the ejabberd Web Admin contain a link to a related +section in the ejabberd Installation and Operation Guide. +In order to view such links, a copy in HTML format of the Guide must +be installed in the system. +The file is searched by default in +\term{"/share/doc/ejabberd/guide.html"}. +The directory of the documentation can be specified in +\term{ejabberd.cfg} with the option \term{doc\_path}. +For example: +\begin{verbatim} +{doc_path, "/usr/local/share/doc/ejabberd/"}. +\end{verbatim} \makesection{adhoccommands}{Ad-hoc Commands} diff --git a/src/mod_shared_roster.erl b/src/mod_shared_roster.erl index d62124d1e..0fd13d4c5 100644 --- a/src/mod_shared_roster.erl +++ b/src/mod_shared_roster.erl @@ -723,7 +723,7 @@ list_shared_roster_groups(Host, Query, Lang) -> ] )] )]), - [?XC("h1", ?T("Shared Roster Groups"))] ++ + ?H1GL(?T("Shared Roster Groups"), "modsharedroster", "mod_shared_roster") ++ case Res of ok -> [?CT("Submitted"), ?P]; error -> [?CT("Bad format"), ?P]; @@ -822,7 +822,7 @@ shared_roster_group(Host, Group, Query, Lang) -> ] )] )]), - [?XC("h1", ?T("Shared Roster Groups"))] ++ + ?H1GL(?T("Shared Roster Groups"), "modsharedroster", "mod_shared_roster") ++ [?XC("h2", ?T("Group ") ++ Group)] ++ case Res of ok -> [?CT("Submitted"), ?P]; diff --git a/src/web/ejabberd_web_admin.erl b/src/web/ejabberd_web_admin.erl index b25882d9a..81211a50f 100644 --- a/src/web/ejabberd_web_admin.erl +++ b/src/web/ejabberd_web_admin.erl @@ -40,6 +40,30 @@ -include("ejabberd_web_admin.hrl"). +process(["doc", LocalFile], _Request) -> + DocPath = case ejabberd_config:get_global_option(doc_path) of + P when is_list(P) -> P; + _ -> "/share/doc/ejabberd/" + end, + %% Code based in mod_http_fileserver + FileName = filename:join(DocPath, LocalFile), + case file:read_file(FileName) of + {ok, FileContents} -> + ?DEBUG("Delivering content.", []), + {200, + [{"Server", "ejabberd"}], + FileContents}; + {error, Error} -> + ?DEBUG("Delivering error: ~p", [Error]), + Help = " " ++ FileName ++ " - Try to specify the path to ejabberd guide.html " + "with the option doc_path. Check the ejabberd Guide for more information", + case Error of + eacces -> {403, [], "Forbidden"++Help}; + enoent -> {404, [], "Not found"++Help}; + _Else -> {404, [], atom_to_list(Error)++Help} + end + end; + process(["server", SHost | RPath], #request{auth = Auth} = Request) -> Host = jlib:nameprep(SHost), case lists:member(Host, ?MYHOSTS) of @@ -509,8 +533,13 @@ h3 { padding-top: 5px; } -*.alignright { +div.guidelink { text-align: right; + padding-right: 1em; +} + +*.alignright { + font-size: 10pt; } ". @@ -556,8 +585,8 @@ process_admin(global, lang = Lang}) -> Base = get_base_path(global, cluster), MenuItems2 = make_menu_items(global, cluster, Base, Lang), - make_xhtml([?XCT("h1", "Administration"), - ?XE("ul", + make_xhtml(?H1GL(?T("Administration"), "toc", "Contents") ++ + [?XE("ul", [?LI([?ACT("/admin/acls/", "Access Control Lists"), ?C(" "), ?ACT("/admin/acls-raw/", "(Raw)")]), ?LI([?ACT("/admin/access/", "Access Rules"), ?C(" "), @@ -631,7 +660,7 @@ process_admin(Host, "~p.", [lists:keysort( 2, ets:select(acl, [{{acl, {'$1', Host}, '$2'}, [], [{{acl, '$1', '$2'}}]}]))])), - make_xhtml([?XCT("h1", "Access Control Lists")] ++ + make_xhtml(?H1GL(?T("Access Control Lists"), "ACLDefinition", "ACL Definition") ++ case Res of ok -> [?CT("Submitted"), ?P]; error -> [?CT("Bad format"), ?P]; @@ -674,7 +703,7 @@ process_admin(Host, ACLs = lists:keysort( 2, ets:select(acl, [{{acl, {'$1', Host}, '$2'}, [], [{{acl, '$1', '$2'}}]}])), - make_xhtml([?XCT("h1", "Access Control Lists")] ++ + make_xhtml(?H1GL(?T("Access Control Lists"), "ACLDefinition", "ACL Definition") ++ case Res of ok -> [?CT("Submitted"), ?P]; error -> [?CT("Bad format"), ?P]; @@ -742,7 +771,7 @@ process_admin(Host, [{{config, {access, '$1', Host}, '$2'}, [], [{{access, '$1', '$2'}}]}])])), - make_xhtml([?XCT("h1", "Access Rules")] ++ + make_xhtml(?H1GL(?T("Access Rules"), "AccessRights", "Access Rights") ++ case Res of ok -> [?CT("Submitted"), ?P]; error -> [?CT("Bad format"), ?P]; @@ -780,7 +809,7 @@ process_admin(Host, [{{config, {access, '$1', Host}, '$2'}, [], [{{access, '$1', '$2'}}]}]), - make_xhtml([?XCT("h1", "Access Rules")] ++ + make_xhtml(?H1GL(?T("Access Rules"), "AccessRights", "Access Rights") ++ case Res of ok -> [?CT("Submitted"), ?P]; error -> [?CT("Bad format"), ?P]; @@ -837,7 +866,7 @@ process_admin(global, #request{path = ["vhosts"], lang = Lang}) -> Res = list_vhosts(Lang), - make_xhtml([?XCT("h1", "ejabberd virtual hosts")] ++ Res, global, Lang); + make_xhtml(?H1GL(?T("ejabberd virtual hosts"), "virtualhost", "Virtual Hosting") ++ Res, global, Lang); process_admin(Host, #request{path = ["users"], @@ -1786,7 +1815,8 @@ get_node(global, Node, ["ports"], Query, Lang) -> end, NewPorts = lists:sort( rpc:call(Node, ejabberd_config, get_local_option, [listen])), - [?XC("h1", ?T("Listened Ports at ") ++ atom_to_list(Node))] ++ + H1String = ?T("Listened Ports at ") ++ atom_to_list(Node), + ?H1GL(H1String, "listened", "Listening Ports") ++ case Res of ok -> [?CT("Submitted"), ?P]; error -> [?CT("Bad format"), ?P]; @@ -1809,7 +1839,8 @@ get_node(Host, Node, ["modules"], Query, Lang) when is_list(Host) -> end, NewModules = lists:sort( rpc:call(Node, gen_mod, loaded_modules_with_opts, [Host])), - [?XC("h1", ?T("Modules at ") ++ atom_to_list(Node))] ++ + H1String = ?T("Modules at ") ++ atom_to_list(Node), + ?H1GL(H1String, "modoverview", "Modules Overview") ++ case Res of ok -> [?CT("Submitted"), ?P]; error -> [?CT("Bad format"), ?P]; diff --git a/src/web/ejabberd_web_admin.hrl b/src/web/ejabberd_web_admin.hrl index ddceaa1ee..015886dba 100644 --- a/src/web/ejabberd_web_admin.hrl +++ b/src/web/ejabberd_web_admin.hrl @@ -50,3 +50,17 @@ {"size", Size}])). -define(INPUTST(Type, Name, Value, Size), ?INPUT(Type, Name, ?T(Value), Size)). -define(ACLINPUT(Text), ?XE("td", [?INPUT("text", "value" ++ ID, Text)])). + +%% Guide Link +-define(GL(Ref, Title), + ?XAE("div", + [{"class", "guidelink"}], + [?XAE("a", + [{"href", "/admin/doc/guide.html#"++ Ref}, + {"target", "_blank"}], + [?C("[Guide: " ++ Title ++ "]")]) + ])). + + +%% h1 with a Guide Link +-define(H1GL(Name, Ref, Title), [?XC("h1", Name), ?GL(Ref, Title)]). |