Patch to theme ejabberd with logo and CSS files

Hello,

The ejabberd-1.0.0 source patch below adds 3 global configuration variables to ejabberd.cfg that allow actual files to be used for the css file, logo, and filler image used by the ejabberd 1.0.0 web interface. Currently, the images and css file are contained in the ejabberd source itself, making it difficult to modify them should the need arise. Simply put this patch in the same directory as your decompressed ejabberd-1.0.0 distribution directory, and run the patch command as follows

user@host /usr/local/src$ patch -p0
add_option(s2s_certfile, CertFile, State);
{domain_certfile, Domain, CertFile} ->
add_option({domain_certfile, Domain}, CertFile, State);
+ {css, Path} ->
+ add_option(css, Path, State);
+ {logo, Path} ->
+ add_option(logo, Path, State);
+ {logo_fill, Path} ->
+ add_option(logo_fill, Path, State);
{Opt, Val} ->
lists:foldl(fun(Host, S) -> process_host_term(Term, Host, S) end,
State, State#state.hosts)
@@ -146,6 +152,12 @@ add_option(Opt, Val, State) ->
config;
language ->
config;
+ css ->
+ config;
+ logo ->
+ config;
+ logo_fill ->
+ config;
_ ->
local_config
end,
diff -rup ejabberd-1.0.0/src/Makefile.in ejabberd-1.0.0-patched/src/Makefile.in
--- ejabberd-1.0.0/src/Makefile.in 2005-12-11 17:11:50.000000000 -0500
+++ ejabberd-1.0.0-patched/src/Makefile.in 2006-04-06 18:08:12.000000000 -0400
@@ -28,7 +28,7 @@ ERLSHLIBS = expat_erl.so
SOURCES = $(wildcard *.erl)
BEAMS = $(SOURCES:.erl=.beam)

-DESTDIR =
+DESTDIR = @prefix@

EJABBERDDIR = $(DESTDIR)/var/lib/ejabberd
BEAMDIR = $(EJABBERDDIR)/ebin
diff -rup ejabberd-1.0.0/src/web/ejabberd_web_admin.erl ejabberd-1.0.0-patched/src/web/ejabberd_web_admin.erl
--- ejabberd-1.0.0/src/web/ejabberd_web_admin.erl 2005-11-27 17:09:12.000000000 -0500
+++ ejabberd-1.0.0-patched/src/web/ejabberd_web_admin.erl 2006-04-06 18:08:12.000000000 -0400
@@ -154,373 +154,16 @@ make_xhtml(Els, Host, Lang) ->
])])])
]}}.

-css(Host) ->
- Base = case Host of
- global ->
- "/admin/";
- _ ->
- "/admin/server/" ++ Host ++ "/"
- end,
- "
-html,body {
- background: white;
- margin: 0;
- padding: 0;
- height: 100%;
-}
-
-#container {
- padding: 0;
- margin: 0;
- min-height: 100%;
- height: 100%;
- margin-bottom: -30px;
-}
-
-html>body #container {
- height: auto;
-}
-
-#header h1 {
- width: 100%;
- height: 55px;
- padding: 0;
- margin: 0;
- background: transparent url(\"" ++ Base ++ "logo-fill.png\");
-}
-
-#header h1 a {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 55px;
- padding: 0;
- margin: 0;
- background: transparent url(\"" ++ Base ++ "logo.png\") no-repeat;
- display: block;
- text-indent: -700em;
-}
-
-#clearcopyright {
- display: block;
- width: 100%;
- height: 30px;
-}
-
-#copyrightouter {
- display: table;
- width: 100%;
- height: 30px;
-}
-
-#copyright {
- display: table-cell;
- vertical-align: bottom;
- width: 100%;
- height: 30px;
-}
-
-#copyright p {
- margin-left: 0;
- margin-right: 0;
- margin-top: 5px;
- margin-bottom: 0;
- padding-left: 0;
- padding-right: 0;
- padding-top: 1px;
- padding-bottom: 1px;
- width: 100%;
- color: #ffffff;
- background-color: #fe8a00;
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 7pt;
- font-weight: bold;
- text-align: center;
-}
-
-#navigation ul {
- position: absolute;
- top: 54px;
- left: 0;
- padding: 0 1px 1px 1px;
- margin: 0;
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 8pt;
- font-weight: bold;
- background: #d47911;
- width: 13em;
-}
-
-#navigation ul li {
- list-style: none;
- margin: 0;
- text-align: left;
- display: inline;
-}
-
-#navigation ul li a {
- margin: 0;
- display: block;
- padding: 3px 6px 3px 9px;
- border-left: 1em solid #ffc78c;
- border-top: 1px solid #d47911;
- background: #ffe3c9;
- text-decoration: none;
-}
-
-#navigation ul li a:link {
- color: #844;
-}
-
-#navigation ul li a:visited {
- color: #766;
-}
-
-#navigation ul li a:hover {
- border-color: #fc8800;
- color: #FFF;
- background: #332;
-}
-
-#lastactivity li {
- font-weight: bold;
- border: 1px solid #d6760e;
- background-color: #fff2e8;
- padding: 2px;
- margin-bottom: -1px;
-}
-
-td.copy {
- color: #ffffff;
- background-color: #fe8a00;
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 7pt;
- font-weight: bold;
- text-align: center;
-}
-
-input {
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 10pt;
- border: 1px solid #d6760e;
- color: #723202;
- background-color: #fff2e8;
- vertical-align: middle;
- margin-bottom: 0px;
- padding: 0.1em;
-}
-
-input[type=submit] {
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 8pt;
- font-weight: bold;
- color: #ffffff;
- background-color: #fe8a00;
- border: 1px solid #d6760e;
-}
-
-textarea {
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 10pt;
- border: 1px solid #d6760e;
- color: #723202;
- background-color: #fff2e8;
- vertical-align: middle;
- margin-top: 7px;
- margin-bottom: 5px;
- padding: 0.1em;
-}
-
-select {
- border: 1px solid #d6760e;
- color: #723202;
- background-color: #fff2e8;
- vertical-align: middle;
- margin-bottom: 0px;
- padding: 0.1em;
-}
-
-thead {
- color: #000000;
- background-color: #ffffff;
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 10pt;
- font-weight: bold;
-}
-
-tr.head {
- color: #ffffff;
- background-color: #3b547a;
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 9pt;
- font-weight: bold;
- text-align: center;
-}
-
-tr.oddraw {
- color: #412c75;
- background-color: #ccd4df;
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 9pt;
- font-weight: normal;
- text-align: center;
-}
-
-tr.evenraw {
- color: #412c75;
- background-color: #dbe0e8;
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 9pt;
- font-weight: normal;
- text-align: center;
-}
-
-td.leftheader {
- color: #412c75;
- background-color: #ccccc1;
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 9pt;
- font-weight: bold;
- padding-left: 5px;
- padding-top: 2px;
- padding-bottom: 2px;
- margin-top: 0px;
- margin-bottom: 0px;
-}
-
-td.leftcontent {
- color: #000044;
- background-color: #e6e6df;
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 7pt;
- font-weight: normal;
- padding-left: 5px;
- padding-right: 5px;
- padding-top: 2px;
- padding-bottom: 2px;
- margin-top: 0px;
- margin-bottom: 0px;
-}
-
-td.rightcontent {
- color: #000044;
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 10pt;
- font-weight: normal;
- text-align: justify;
- padding-left: 10px;
- padding-right: 10px;
- padding-bottom: 5px;
-}
-
-
-h1 {
- color: #000044;
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 14pt;
- font-weight: bold;
- text-align: center;
- padding-top: 2px;
- padding-bottom: 2px;
- margin-top: 0px;
- margin-bottom: 0px;
-}
-
-h2 {
- color: #000044;
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 12pt;
- font-weight: bold;
- text-align: center;
- padding-top: 2px;
- padding-bottom: 2px;
- margin-top: 0px;
- margin-bottom: 0px;
-}
-
-h3 {
- color: #000044;
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 10pt;
- font-weight: bold;
- text-align: left;
- padding-top: 20px;
- padding-bottom: 2px;
- margin-top: 0px;
- margin-bottom: 0px;
-}
-
-#content a:link {
- color: #990000;
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 10pt;
- font-weight: bold;
- text-decoration: underline;
-}
-#content a:visited {
- color: #990000;
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 10pt;
- font-weight: bold;
- text-decoration: underline;
-}
-#content a:hover {
- color: #cc6600;
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 10pt;
- font-weight: bold;
- text-decoration: underline;
-}
-
-
-#content ul li {
- list-style-type: disc;
- font-size: 10pt;
- /*font-size: 7pt;*/
- padding-left: 10px;
-}
-
-#content li.big {
- font-size: 10pt;
-}
-
-#content {
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: 10pt;
- padding-left: 13em;
- padding-top: 5px;
-}
-
-*.alignright {
- text-align: right;
-}
-
-".
+% read the CSS file to use from a file
+css() ->
+ binary_to_list(element(2, file:read_file(ejabberd_config:get_global_option(css)))).

+%% read the logo and filler images from files like a normal program...
logo() ->
- jlib:decode_base64(
- "iVBORw0KGgoAAAANSUhEUgAAAVcAAAA3CAMAAACPbPnEAAAAYFBMVEX///8C"
- "AgJyMgL+vm7Wdg7+igL+/v7+slb+qkb+4sr+ojP+nir+lhr+1qb+khL+wnb+"
- "wn7+zpb+jgb+yoz+xo7+tmL+pj7+mib+jg7+5sb+rlL+rkr+mh7+tl7+2q7+"
- "umpJ0uikAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIA"
- "AAsSAdLdfvwAAAAHdElNRQfUBAUJBhWzc9qJAAABQ0lEQVR42u2bXU/CQBBF"
- "UUZFURAU5Ev4//+S3Ow+tFl3s6adtE3Oebghzc4DJ/Nw04WZgQczexJkz4lX"
- "vOKVxKuXV6APTCFXAq94xSte8ermFYbrA6+ilemZRxGz+fxBxMydL0/Vz5an"
- "vkUrPfb1IPCKV7ziFa9uXsG/DzyLPz7ndjS3tc3tSbcwPdl9tmYq3dHmk9x3"
- "r8mtiM11KfCKV7ziFa9uXmEc7wf+u6+5TtlXf62fKu9rl3wX9ibsLPCKV7zi"
- "Fa9uXmF87wf67aBT6a+hp4bOehFxU0/CbgKveMUrXvHq5hXG+vuBcpss75zH"
- "/VZ5X7vcb4W7q5A/wvbCXoTNhX0JvOIVr3jFq5tX4P8Fw2V6g7UQ9itsLeKm"
- "fgi84hWveMWrm1egDwyX6Q3WTtinsI2wq7CjwCte8YpXvLp5BQ/utIiGbwh9"
- "RAEAAAAASUVORK5CYII=").
+ binary_to_list(element(2, file:read_file(ejabberd_config:get_global_option(logo)))).

logo_fill() ->
- jlib:decode_base64(
- "iVBORw0KGgoAAAANSUhEUgAAAAYAAAA3BAMAAADdxCZzAAAAHlBMVEXWdg7+"
- "igL+jg7+khL+nir+rkr+umr+yoz+1qb+5sbOf9L8AAAACXBIWXMAAA9hAAAP"
- "YQGoP6dpAAAAQUlEQVQI12XDSxHAIBAFQT6BJEcsYAELWMACFtYCFnAL7zxd"
- "1c5dvhSU2BpKqBXl6R0ljYGS50R5zVC+tVD+vfE6YyUexE9x7g4AAAAASUVO"
- "RK5CYII=").
+ binary_to_list(element(2, file:read_file(ejabberd_config:get_global_option(logo_fill)))).

process_admin(global,
#request{us = US,
@@ -573,7 +216,7 @@ process_admin(Host,
path = ["style.css"],
q = Query,
lang = Lang} = Request) ->
- {200, [{"Content-Type", "text/css"}], css(Host)};
+ {200, [{"Content-Type", "text/css"}], css()};

process_admin(Host,
#request{us = US,
======================================== END PATCH ========================================

oops

The command to apply the patch is:

user@host /usr/local/src$ patch -p0 <theme.patch

hi, i am using installer to

hi,
i am using installer to install ejabberd on windows. could u guide me on how to apply this patch to change the theme on windows.
i am a newbie and require detailed instructions.
thank you in advance..
please reply asap..

You probably will be unable

You probably will be unable to do this.

Most likely, you install the newest stable release (ie 2.1.10 or released yesterday 2.1.11). The patch that you want to apply was made in 2006 for ejabberd version 1.x. The brief look at sources shows that they have changed substantially enough to break the patch.

If you were using a compatible version, then you would need to get the source files for your ejabberd, and recompile the changed files after applying the patch.
But from your question, it seems that you are unfamiliar with the source patches, so the patching may be difficult to impossible to you anyway.

You could file a feature request in JIRA mentioning this patch, so that developers would bundle the required functionality into the program.

double-oops!

As I should've guessed, HTML formatting makes the copied patch useless. It can be downloaded from

http://members.dca.net/fpater/permanent/theme.patch

Sorry for any confusion.

-frank

Syndicate content