]> granicus.if.org Git - ejabberd/commitdiff
* src/web/ejabberd_web_admin.erl: WebAdmin serves Guide and links
authorBadlop <badlop@process-one.net>
Wed, 7 Jan 2009 00:55:02 +0000 (00:55 +0000)
committerBadlop <badlop@process-one.net>
Wed, 7 Jan 2009 00:55:02 +0000 (00:55 +0000)
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

SVN Revision: 1777

ChangeLog
doc/guide.html
doc/guide.tex
src/mod_shared_roster.erl
src/web/ejabberd_web_admin.erl
src/web/ejabberd_web_admin.hrl

index 67c4f575ebe57d4cc4abe1281283c7ca1d4adbb8..0192aa7e0d6b8d6ed5aecd31866cc0f3c7b32610 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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)
index 6d143c335e24ddeb334385d34c91112f3ed8047e..b7466955e2f342d83cd6848e4e4d0bc3c9cea834 100644 (file)
@@ -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>&#XA0;&#XA0;<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.
index afc63a3ffb10c30fcac894666f04f7a06e517ed6..c3fb6db07cae6089893ad21f371bf5610f825123 100644 (file)
@@ -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}
 
index d62124d1e4c504ddfb023a70e5d0ace83e8a0732..0fd13d4c57b6bb9867cb9a9b8617ff0ea0989ba3 100644 (file)
@@ -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];
index b25882d9a2928da392e01b4172a9d66f1d39f9ab..81211a50f4c7a669e637fe1b1b2461a119d14a29 100644 (file)
 -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];
index ddceaa1ee997e511566a2ac25216da7bdd66e993..015886dbad7dfadc89de7f994538417f9593335e 100644 (file)
                      {"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)]).