From: rjk@greenend.org.uk <>
Date: Fri, 28 Dec 2007 18:08:34 +0000 (+0000)
Subject: make url.static work as described, and adjust cgi setup details
X-Git-Tag: 3.0~149
X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/5e34540b562f91c7b383a307c32e1a159266dd11?ds=inline
make url.static work as described, and adjust cgi setup details
---
diff --git a/README b/README
index 19a9a72..373e572 100644
--- a/README
+++ b/README
@@ -185,8 +185,17 @@ These instructions assumes you are using Apache 1.3.x.
You need to configure a number of things to make this work:
-1. If you want to have a 'jukebox' virtual host, modify the DNS accordingly and
- use a fragment such as this one:
+1. The web interface depends on a 'guest' user existing. You can create this
+ with the following command:
+
+ disorder setup-guest
+
+ If you don't want to allow online registration instead use:
+
+ disorder -- setup-guest --no-online-registration
+
+2a. If you want to have a 'jukebox' virtual host, modify the DNS accordingly
+ and use a fragment such as this one:
DocumentRoot /home/jukebox/public_html
@@ -198,50 +207,57 @@ You need to configure a number of things to make this work:
Alias /static/ /usr/local/share/disorder/static/
- /static/ should point to the 'static' directory installed by DisOrder. If
- you don't want to use the name 'static' then you can change the url.static
- label in the web interface configuration to your preferred URL; see
- disorder_config(5) for details.
-
Don't forget to reload Apache after modifying its configuration.
- Separate logging is not required but I find it convenient. Up to you.
+ You must tell the web interface how to find its icons and stylesheet:
-2. The web interface depends on a 'guest' user existing. You can create this
- with the following command:
+ echo label url.static /static/ >> /etc/disorder/options.user
+ echo label links.css /static/disorder.css >> /etc/disorder/options.user
- disorder setup-guest
+2b. If you don't want a virtual host then you must still make sure that
+ DisOrder can find its icons and stylesheet. For example in your web server
+ configuration:
- If you don't want to allow online registration instead use:
+ Alias /disorder/ /usr/local/share/disorder/static/
- disorder -- setup-guest --no-online-registration
+ Alternatively you could use a symlink from the right location in your
+ document root, provided your web server is configured to follow them.
+
+ Also you must tell the web interface how to find them:
+
+ echo label url.static /disorder/ >> /etc/disorder/options.user
+ echo label links.css /disorder/disorder.css >> /etc/disorder/options.user
3. Install disorder.cgi in an appropriate location. Remember to make it
- executable. For example:
+ executable. For example assuming a virtual host as above (2a):
install -m 755 clients/disorder.cgi ~jukebox/public_html/index.cgi
+ or not (2b):
+
+ install -m 755 clients/disorder.cgi /usr/lib/cgi-bin/disorder
+
4. Try it out. You should be able to perform read-only operations straight
away, and after visiting the 'Login' page to authenticate, perform other
operations like adding a track to the queue.
5. If you run into problems, always look at the appropriate error log; the
- message you see in your web browser will usually not be sufficient to
- diagnose the problem all by itself.
+ message you see in your web browser will usually not be sufficient to
+ diagnose the problem all by itself.
6. If you have a huge number of top level directories, then you might find
- that the 'Choose' page is unreasonably large. If so add the following line
- to /etc/disorder/options.user:
- label sidebar.choosewhich choosealpha
-
- This will make 'Choose' be a link for each letter of the 26-letter Roman
- alphabet; follow the link and you just get the directories which start with
- that letter. The "*" link at the end gives you directories which don't
- start with a letter.
-
- You can copy choosealpha.html to /etc/disorder and edit it to change the
- set of initial choices to anything that can be expressed with regexps. The
- regexps must be URL-encoded UTF-8 PCRE regexps.
+ that the 'Choose' page is unreasonably large. If so add the following line
+ to /etc/disorder/options.user:
+ label sidebar.choosewhich choosealpha
+
+ This will make 'Choose' be a link for each letter of the 26-letter Roman
+ alphabet; follow the link and you just get the directories which start with
+ that letter. The "*" link at the end gives you directories which don't
+ start with a letter.
+
+ You can copy choosealpha.html to /etc/disorder and edit it to change the
+ set of initial choices to anything that can be expressed with regexps. The
+ regexps must be URL-encoded UTF-8 PCRE regexps.
Copyright
diff --git a/debian/etc.disorder.options b/debian/etc.disorder.options
index ef05cbc..3a696ef 100644
--- a/debian/etc.disorder.options
+++ b/debian/etc.disorder.options
@@ -7,19 +7,8 @@ include options.columns
# trackname transformations - supply your own or keep the default
include options.transform
-label images.enabled /disorder/tick.png
-label images.disabled /disorder/cross.png
-label images.scratch /disorder/cross.png
-label images.noscratch /disorder/nocross.png
-label images.up /disorder/up.png
-label images.noup /disorder/noup.png
-label images.down /disorder/down.png
-label images.nodown /disorder/nodown.png
-label images.edit /disorder/edit.png
-label images.upall /disorder/upup.png
-label images.noupall /disorder/noupup.png
-label images.downall /disorder/downdown.png
-label images.nodownall /disorder/nodowndown.png
+# where to find static web content
+label url.static /disorder/
label links.css /disorder/disorder.css
# user overrides - you supply this
diff --git a/server/cgi.c b/server/cgi.c
index 2189532..5e475ed 100644
--- a/server/cgi.c
+++ b/server/cgi.c
@@ -585,9 +585,19 @@ const char *cgi_label(const char *key) {
read_options();
if(!(label = kvp_get(labels, key))) {
- if((label = strchr(key, '.')))
+ /* No label found */
+ if(!strncmp(key, "images.", 7)) {
+ static const char *url_static;
+ /* images.X defaults to X.png */
+
+ if(!url_static)
+ url_static = cgi_label("url.static");
+ byte_xasprintf((char **)&label, "%s%s.png", url_static, key + 7);
+ } else if((label = strchr(key, '.')))
+ /* X.Y defaults to Y */
++label;
else
+ /* otherwise default to label name */
label = key;
}
return label;
diff --git a/templates/options.labels b/templates/options.labels
index ca2fa7b..f72ab84 100644
--- a/templates/options.labels
+++ b/templates/options.labels
@@ -200,24 +200,12 @@ label heading.album Album
label heading.title Title
label heading.length Length
-# Images. These are (possibly relative) URLs. In the factory configuration
-# DisOrder assumes that you have arranged for 'static' relative to the base
-# URL (i.e. the URL of the CGI) to point somewhere useful, but it's not
-# the only way. The .deb for instance uses /disorder instead.
-label images.enabled static/tick.png
-label images.disabled static/cross.png
-label images.scratch static/cross.png
-label images.noscratch static/nocross.png
-label images.up static/up.png
-label images.noup static/noup.png
-label images.down static/down.png
-label images.nodown static/nodown.png
-label images.edit static/edit.png
-label images.upall static/upup.png
-label images.noupall static/noupup.png
-label images.downall static/downdown.png
-label images.nodownall static/nodowndown.png
-
-# Stylesheet. As above, a (possibly relative) URL.
+# (Possibly relative) URL to images. This be a URL for the directory
+# containing the icons used by the web interface (which might be
+# /usr/local/share/disorder/static/).
+label url.static static/
+
+# Stylesheet. As above, a (possibly relative) URL, but this time pointing
+# to the stylesheet to use in all DisOrder web pages.
label links.css static/disorder.css