Greenbug is an online XSL template editor for Greenstone3. Named Greenbug as it is a bit like Firebug, but for Greenstone, not Firefox.
To use Greenbug you must have DebugService in the list of services in your siteConfig.xml file. This service handles the saving and retrieving of the XSL templates, and is included by default.
In the web interface you will need to log in. as an administrator. Click the login
button in the top right menu. Once logged in, click the username
button, and select enable edit mode
. (If disable edit mode
is in the menu, then edit mode is already enabled and you don't need to click it.)
administrator
group. For Greenstone nightly releases after 10 Nov 2014, you can be in all-collections-editor
or collname-collection-editor
groups also.Once this is done you can go to the page you want to debug and click the green bug icon that shows up at the bottom left. (This will add "debug=1" to the CGI arguments for that page).
To view or modify a template for an element in the page, click Select new element
. Then move the cursor over the page, and you'll see red boxes outline parts of the page. When the red box is surrounding the piece you want to change, then click the left mouse button.
The editor will open up with a visual representation of the template. You can work with the visual editor or click switch to XML editor
to view the raw XML of the template.
Modify the template, then click Save changes
. The template will be saved to the collection, and the collection reloaded in the library, so you will see the effect of the changes straight away.
In the XML editor, you get the raw XML of the applicable template. Modify the template as you would normally, and save. Note that you will not be able to save invalid XML. Once you have entered valid XML (e.g. closed off all your tags properly, etc), then you will see XML OK!
next to the Undo button. While you are editing and the XML is invalid, you will get the message XML Error! (Mouse over for details)
, and the Save changes
button will be deactivated.
Undo will undo character by character the typing you have just entered. To undo a saved change, undo the changes to the template and click save changes
.
The visual editor looks a bit more complicated, but it aims to help you by providing a list of elements for you to drag and drop. The list down the left hand side contains elements you can add to the template. There are several groups of elements, listed in the heading tabs: html, xsl, gsf, gslib, other. Click these tabs to get the list of elements in the different groups.
Select the element you want and drag it onto the template. You can move it around until it goes into the place you want, then let it go. You can put it beside an existing element, or inside one.
Clicking on an element in the template will show you, to the right hand side, the element name and a list of its attributes. You can add a new attribute to the element by selecting the attribute name from the drop down list, and clicking Add attribute
. The attribute will be added to the list, and you can enter the value of it. Click done
when done, or delete
to remove it.
Plain text and new elements can be added using the other
tab in the left hand list.
Don't forget to save changes
when done.