]> granicus.if.org Git - ejabberd/commitdiff
Support RTL page direction in WebAdmin for Hebrew (#650)
authorBadlop <badlop@process-one.net>
Wed, 15 Jul 2015 17:01:32 +0000 (19:01 +0200)
committerBadlop <badlop@process-one.net>
Wed, 15 Jul 2015 17:01:32 +0000 (19:01 +0200)
src/ejabberd_web_admin.erl

index 1838922bc8e63fb191f3fbcbd93ece225b9bc79f..1b58af6696f45a0009e2d471754a1dfdd446b86c 100644 (file)
@@ -296,7 +296,7 @@ make_xhtml(Els, Host, Node, Lang, JID) ->
      #xmlel{name = <<"html">>,
            attrs =
                [{<<"xmlns">>, <<"http://www.w3.org/1999/xhtml">>},
-                {<<"xml:lang">>, Lang}, {<<"lang">>, Lang}],
+                {<<"xml:lang">>, Lang}, {<<"lang">>, Lang}]++direction(Lang),
            children =
                [#xmlel{name = <<"head">>, attrs = [],
                        children =
@@ -346,6 +346,10 @@ make_xhtml(Els, Host, Node, Lang, JID) ->
                                   ?AC(<<"https://www.process-one.net/">>, <<"ProcessOne">>)]
                                  )])])])]}}.
 
+direction(ltr) -> [{<<"dir">>, <<"ltr">>}];
+direction(<<"he">>) -> [{<<"dir">>, <<"rtl">>}];
+direction(_) -> [].
+
 get_base_path(global, cluster) -> <<"/admin/">>;
 get_base_path(Host, cluster) ->
     <<"/admin/server/", Host/binary, "/">>;
@@ -513,7 +517,7 @@ css(Host) ->
       "0px;\n}\n\nh3 {\n  color: #000044;\n "
       " font-family: Verdana, Arial, Helvetica, "
       "sans-serif; \n  font-size: 10pt;\n  "
-      "font-weight: bold;\n  text-align: left;\n "
+      "font-weight: bold;\n "
       " padding-top: 20px;\n  padding-bottom: "
       "2px;\n  margin-top: 0px;\n  margin-bottom: "
       "0px;\n}\n\n#content a:link {\n  color: "
@@ -671,7 +675,7 @@ process_admin(Host,
                 end
                   ++
                   [?XAE(<<"form">>,
-                        [{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}],
+                        [{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}]++direction(ltr),
                         [?TEXTAREA(<<"acls">>,
                                    (iolist_to_binary(integer_to_list(lists:max([16,
                                                                                 NumLines])))),
@@ -708,7 +712,7 @@ process_admin(Host,
                   ++
                   [?XAE(<<"p">>, direction(ltr), [?ACT(<<"../acls-raw/">>, <<"Raw">>)])] ++
                     [?XAE(<<"form">>,
-                          [{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}],
+                          [{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}]++direction(ltr),
                           [acls_to_xhtml(ACLs), ?BR,
                            ?INPUTT(<<"submit">>, <<"delete">>,
                                    <<"Delete Selected">>),
@@ -773,7 +777,7 @@ process_admin(Host,
                 end
                   ++
                   [?XAE(<<"form">>,
-                        [{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}],
+                        [{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}]++direction(ltr),
                         [?TEXTAREA(<<"access">>,
                                    (iolist_to_binary(integer_to_list(lists:max([16,
                                                                                 NumLines])))),
@@ -808,7 +812,7 @@ process_admin(Host,
                   [?XAE(<<"p">>, direction(ltr), [?ACT(<<"../access-raw/">>, <<"Raw">>)])]
                     ++
                     [?XAE(<<"form">>,
-                          [{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}],
+                          [{<<"action">>, <<"">>}, {<<"method">>, <<"post">>}]++direction(ltr),
                           [access_rules_to_xhtml(AccessRules, Lang), ?BR,
                            ?INPUTT(<<"submit">>, <<"delete">>,
                                    <<"Delete Selected">>)])],
@@ -2384,7 +2388,7 @@ node_ports_to_xhtml(Ports, Lang) ->
                                          [?INPUTS(<<"text">>,
                                                   <<"module", SSPort/binary>>,
                                                   SModule, <<"15">>)]),
-                                     ?XE(<<"td">>,
+                                     ?XAE(<<"td">>, direction(ltr),
                                          [?TEXTAREA(<<"opts", SSPort/binary>>,
                                                     (iolist_to_binary(integer_to_list(NumLines))),
                                                     <<"35">>, SOptsClean)]),
@@ -2410,7 +2414,7 @@ node_ports_to_xhtml(Ports, Lang) ->
                       ?XE(<<"td">>,
                           [?INPUTS(<<"text">>, <<"modulenew">>, <<"">>,
                                    <<"15">>)]),
-                      ?XE(<<"td">>,
+                      ?XAE(<<"td">>, direction(ltr),
                           [?TEXTAREA(<<"optsnew">>, <<"2">>, <<"35">>,
                                      <<"[]">>)]),
                       ?XAE(<<"td">>, [{<<"colspan">>, <<"2">>}],
@@ -2527,7 +2531,7 @@ node_modules_to_xhtml(Modules, Lang) ->
                                                                       40),
                                 ?XE(<<"tr">>,
                                     [?XC(<<"td">>, SModule),
-                                     ?XE(<<"td">>,
+                                     ?XAE(<<"td">>, direction(ltr),
                                          [?TEXTAREA(<<"opts", SModule/binary>>,
                                                     (iolist_to_binary(integer_to_list(NumLines))),
                                                     <<"40">>, SOpts)]),
@@ -2546,7 +2550,7 @@ node_modules_to_xhtml(Modules, Lang) ->
                 [?XE(<<"tr">>,
                      [?XE(<<"td">>,
                           [?INPUT(<<"text">>, <<"modulenew">>, <<"">>)]),
-                      ?XE(<<"td">>,
+                      ?XAE(<<"td">>, direction(ltr),
                           [?TEXTAREA(<<"optsnew">>, <<"2">>, <<"40">>,
                                      <<"[]">>)]),
                       ?XAE(<<"td">>, [{<<"colspan">>, <<"2">>}],