Deprecated web features
This page documents older ways of writing custom web pages: <odb> tags, the AJAX interface and other features of older custom pages. It's kept for maintaining existing pages. New pages should use the JavaScript libraries and JSON-RPC instead.
<odb> tags
Deprecated
<odb> tags are deprecated. It is documented here for completeness, but you are strongly recommended to use the modbvalue family of tools instead.
An <odb src="/Path/To/Key"> tag in a custom page is replaced by the key's value when mhttpd serves the page. Adding edit=1 lets the user click the value to change it, optionally protected by a password.
AJAX interface
Deprecated
The AJAX interface is deprecated. It is documented here for completeness, but you are strongly recommended to use the other mjsonrpc interfaces for writing web pages, or python code for scripting.
Before JSON-RPC, web pages and scripts called mhttpd with plain HTTP requests, choosing the operation with the cmd URL parameter. For example:
curl "http://localhost:8080/?cmd=jget&odb=/Runinfo/Run%20number"
curl "http://localhost:8080/?cmd=jset&odb=/Runinfo/Run%20number&value=123"
curl "http://localhost:8080/?cmd=jmsg&n=5"
Results are returned as plain text (or JSON for some commands), and errors as text such as <DB_NO_KEY>. Parameter values must be URL-encoded. The JavaScript functions that wrapped these requests, such as ODBGet(), ODBSet(), ODBMGet() and ODBMCopy(), are now in resources/obsolete.js.
mhttpd still accepts these commands. Each has a JSON-RPC method that does the same job. The table links to the midas.js function that calls it or, where there is no such function, to the JSON-RPC method to call with mjsonrpc_call():
| Command | Purpose | Replacement |
|---|---|---|
jget |
Read ODB values | mjsonrpc_db_get_values() |
jset |
Write an ODB value, creating the key if needed | mjsonrpc_db_paste() |
jcopy |
Read an ODB subtree as ODB, XML or JSON | mjsonrpc_db_copy() |
jkey |
Read a key's type, size and last-written time | mjsonrpc_db_key() |
jcreate |
Create keys | mjsonrpc_db_create() |
jresize |
Change the length of an array or string | mjsonrpc_db_resize() |
jrename |
Rename a key | mjsonrpc_call() with db_rename |
jlink |
Create a link | mjsonrpc_call() with db_link |
jreorder |
Move a key within its directory | mjsonrpc_call() with db_reorder |
jdelete |
Delete keys | mjsonrpc_db_delete() |
jmsg |
Read recent messages | mjsonrpc_call() with cm_msg_retrieve |
jgenmsg |
Write a message | mjsonrpc_cm_msg() |
jalm |
List the active alarms | mjsonrpc_call() with get_alarms |
Other features of older custom pages
Deprecated
These features were used by custom pages written before the midas JavaScript libraries existed (before December 2017). They may not all work with current versions of midas. Use the features described in Custom pages: overview for new pages.
- Pages stored in the ODB: a
/Customentry whose value contains more than one line is served as the page's HTML, rather than being the name of a file - Images with live overlays: a GIF image under
/Custom/Images/<name>.gifcan have ODB values drawn on it, configured in itsLabels,BarsandFillssubdirectories. Pages combined these with an HTML image map (<map>and<area>) to make parts of the image clickable - HTML forms: pages used
<form>elements with<input type="submit" name="cmd">buttons (e.g.StartandStop) to send commands to mhttpd - Reloading the whole page: pages used
<meta http-equiv="Refresh">to reload themselves periodically, instead of widgets that update themselves