/Custom ODB tree: Difference between revisions

From MidasWiki
Jump to navigation Jump to search
(Created page with "==== Links ==== <div style="column-count:3;-moz-column-count:3;-webkit-column-count:3"> * MIDAS web server (mhttpd) * </div> == Purpose == The <span style="color...")
 
No edit summary
Line 1: Line 1:
==== Links ====
== Links ==
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* [[mhttpd |MIDAS web server (mhttpd)]]  
* [[mhttpd |MIDAS web server (mhttpd)]]  
Line 5: Line 5:
</div>
</div>


== Purpose ==
= Purpose =
The <span style="color:purple; font-style:italic;">/Custom</span> ODB tree is required if the user wishes to create [[mhttpd]] custom pages. It contains essential data needed for [[mhttpd]] to display a custom page.  
The <span style="color:purple; font-style:italic;">/Custom</span> ODB tree is required if the user wishes to create [[mhttpd]] custom pages. It contains essential data needed for [[mhttpd]] to display a custom page. The <span style="color:purple; font-style:italic;">/images</span> subtree is required if an imagefile (*.gif) is to be displayed on the custom page.


== Creating the /Custom tree ==
= Creating the /Custom tree =
The <span style="color:purple; font-style:italic">/Custom</span> ODB tree is an optional tree that may be [[ODB#Creating ODB keys|created by the user]].  
The <span style="color:purple; font-style:italic">/Custom</span> ODB tree is an optional tree that may be [[ODB#Creating ODB keys|created by the user]].  


= Example  =
The following example using the [[odbedit] ls command shows the optional custom tree for an experiment. Note the use of the "&" character to force the custom pages to be opened in the same frame, and the "!" key to suppress the ''custom-button'' from appearing on the [[mhttpd]] status page
[local:pol:S]/ls -lr /Custom
[local:pol:S]/custom>ls -rl
Key name                        Type    #Val  Size  Last Opn Mode Value
---------------------------------------------------------------------------
custom                          DIR
    ppg_cycle!                  STRING  1    80    36h  0  RWD  /home/pol/online/pol/custom/pol.html
    ppg_cycle&                  STRING  1    80    36h  0  RWD  /home/pol/online/pol/custom/pol_sc.html
    pol_functions!              STRING  1    80    36h  0  RWD  /home/pol/online/pol/custom/pol_functions.js
    style!                      STRING  1    80    36h  0  RWD  /home/pol/online/pol/custom/style.css
    images                      DIR
        pol_sc.gif              DIR
            background          STRING  1    80    36h  0  RWD  /home/pol/online/pol/custom/pol_sc.gif
            labels              DIR
                num bins        DIR
                    Src        STRING  1    256  36h  0  RWD  /Equipment/pol_acq/settings/output/num bins per cycle
                    Format      STRING  1    32    36h  0  RWD  %d
                    Font        STRING  1    32    36h  0  RWD  Medium
                    X          INT    1    4    36h  0  RWD  315
                    Y          INT    1    4    36h  0  RWD  502
                    Align      INT    1    4    36h  0  RWD  0
                    FGColor    STRING  1    8    36h  0  RWD  FFFFFF
                    BGColor    STRING  1    8    36h  0  RWD  0000FF
                dwell time      DIR
                    Src        STRING  1    256  36h  0  RWD  /Equipment/POL_ACQ/Settings/input/dwell time (ms)
                    Format      STRING  1    32    36h  0  RWD  %f ms
                    Font        STRING  1    32    36h  0  RWD  large
                    X          INT    1    4    36h  0  RWD  145
                    Y          INT    1    4    36h  0  RWD  430
                    Align      INT    1    4    36h  0  RWD  0
                    FGColor    STRING  1    8    36h  0  RWD  FFFFFF
                    BGColor    STRING  1    8    36h  0  RWD  0000FF
= Keys in the /Custom tree =
The optional ODB <span style="color:purple; font-style:italic;">/Custom</span> tree may contain
The optional ODB <span style="color:purple; font-style:italic;">/Custom</span> tree may contain


Line 17: Line 54:
*  images subtree used to specify images for custom pages
*  images subtree used to specify images for custom pages
   
   
If keys are defined in this tree, except where noted below, the names of the keys will appear as '''''custom-buttons'''''  on the [[mhttpd]] Status page. By clicking on one of these ''custom-buttons'', the custom page will be visible in a new frame.  
If keys are defined in this tree, except where noted below, the names of the keys will appear as '''''custom-buttons'''''  on the [[mhttpd]] Status page. By clicking on one of these ''custom-buttons'', the custom page will be visible in a new frame (see also [[#Key names in the /Custom tree|Key names]]).  


=== Key names in the /Custom tree ===
The user chooses the names of any keys in the <span style="color:purple; font-style:italic;">/Custom</span> ODB tree except for
* The Key name "Status" is reserved (see [[#Replace Status page]]).  
* the Key name "Status" is reserved (see [[#Replace Status page]]).  
* There are two characters that have special meaning if they are the last character of a Key name in the <span style="color:purple; font-style:italic;">/Custom</span> tree :
* <span style="color:purple; font-style:italic;">/images</span> subtree
 
There are two characters that have special meaning if they are the last character of a Key name in the <span style="color:purple; font-style:italic;">/Custom</span> tree :
**    The character "&" forces the page to be opened within the current frame when the ''custom-button'' is pressed. If this character is omitted, the page will be opened in a new frame.
**    The character "&" forces the page to be opened within the current frame when the ''custom-button'' is pressed. If this character is omitted, the page will be opened in a new frame.
**    The character "!" suppresses the ''custom-button'' from appearing on the main status page (hidden-link).
**    The character "!" suppresses the ''custom-button'' from appearing on the main status page (hidden-link).
Neither of these characters will appear in the name of the button.


The hidden-link feature can be used to provide external webpages hidden from the user, such as a stylesheet or a file of Javascript functions needed by other custom pages.
The hidden-link feature can be used to provide external webpages hidden from the user, such as a stylesheet or a file of Javascript functions needed by other custom pages.


= <span style="color:purple; font-style:italic">Images</span> subtree =
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DIR
</div>
This optional subtree in the  [[#top|/Custom ODB tree]] is created by the user. It is required if an imagefile (*.gif) is to be displayed on a custom page.
This subtree is also required for any labels, bars or fills to be superimposed on the image.
<br>
---------
<br>
== <span style="color:purple; font-style:italic"><Image-name></span> subtree ==
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DIR
* '''Default:'''
</div>
User-created subdirectory named for the corresponding gif-image, e.g. "pol_sc.gif" in the [[#Example|example]] above. For multiple images, multiple subdirectories may be defined.
<br>
---------
<br>
== <span style="color:purple; font-style:italic">Background</span>  ==
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Default:'''
</div>
This key in the  [[#<Image-name> subtree|<image-name> subtree]] contains the path and filename of the image file to be loaded into a custom page. Only '''gif''' format is supported for the image. This optional key is created by the user.
<br>
---------
<br>
== <span style="color:purple; font-style:italic">Labels</span> subtree ==
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DIR
* '''Default:'''
</div>
User-created subdirectory  in the  [[#<Image-name> subtree|<image-name> subtree]] required if labels are to be superimposed on an image on a custom page.
<br>
---------
<br>
=== <span style="color:purple; font-style:italic"><label-name></span> subtree ===
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DIR
* '''Default:'''
</div>
User-created subdirectory  in the  [[#Labels subtree|Labels subtree]] containing keys to define this label as listed below. There will be a <span style="color:purple; font-style:italic"><label-name></span> subtree for each label superimposed on the custom image.
The user creates keys in this subtree with the names and types as listed below. See also the [[#Example|example]] above.
<br>
---------
<br>
==== <span style="color:purple; font-style:italic">Src</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Default:'''
This key in the [[#<label-name>subtree|<label-name> subtree]] contains the path of a valid ODB Key variable. This is the value to be used for this label on an image.
<br>
---------
<br>
==== <span style="color:purple; font-style:italic">Format</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Default:'''
This key in the [[#<label-name>subtree|<label-name> subtree]] contains the format for this label on the image. Format specifications (c.f. "printf" in C) are used to convert the value specified by the [[#Src|Src key]] into the output string that appears on the image.
For example,
* "Count Rate:%5d kB/s"  used to display an integer value
* "%5.2f%% iBu" used to display a floating point value. Note "%%" displays the "%" sign.
<br>
---------
<br>
==== <span style="color:purple; font-style:italic">Font</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Default:'''
This key in the [[#<label-name>subtree|<label-name> subtree]] contains the font size for this label. Supported values are "small",  "medium" or "giant".
<br>
---------
<br>
==== <span style="color:purple; font-style:italic">X</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' INT
* '''Default:'''
This key in the [[#<label-name>subtree|<label-name> subtree]] contains the X position for this label in pixels.
<br>
---------
<br>
==== <span style="color:purple; font-style:italic">Y</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' INT
* '''Default:'''
This key in the [[#<label-name>subtree|<label-name> subtree]] contains the Y position for this label in pixels.
<br>
---------
<br>
==== <span style="color:purple; font-style:italic">Align</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' INT
* '''Default:'''
This key in the [[#<label-name>subtree|<label-name> subtree]] contains an integer representing Horizontal Alignment for this label. Set to one of 0 (left), 1 (center) or 2 (right).
<br>
---------
<br>
==== <span style="color:purple; font-style:italic">FGColor</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Default:'''
This key in the [[#<label-name>subtree|<label-name> subtree]] contains the foreground colour  for this label in the format RRGGBB (hex). See colour table.
<br>
---------
<br>
==== <span style="color:purple; font-style:italic">BGColor</span> ====
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' STRING
* '''Default:'''
This key in the [[#<label-name>subtree|<label-name> subtree]] contains the background colour  for this label in the format RRGGBB (hex). See colour table.
<br>
---------
<br>
=== <span style="color:purple; font-style:italic">Fills/span> subtree ===
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DIR
* '''Default:'''
</div>
User-created subdirectory  in the  [[#<Image-name> subtree|<image-name> subtree]] required if fills are to be superimposed on an image on a custom page.
<br>
---------
<br>
=== <span style="color:purple; font-style:italic">Bars/span> subtree ===
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
* '''Type:''' DIR
* '''Default:'''
</div>
User-created subdirectory  in the  [[#<Image-name> subtree|<image-name> subtree]] required if bars are to be superimposed on an image on a custom page.
<br>
---------
<br>
= Colour Table =
{|  style="text-align: left; width: 100%; background-color: rgb(255, 255, 255);" border="3" cellpadding="2" cellspacing="2"
|-
| colspan="1" rowspan="1" style="vertical-align: top; background-color: rgb(204, 204, 255); font-weight: bold;" | Colour
| colspan="1" rowspan="1" style="vertical-align: top; background-color: rgb(204, 204, 255); font-weight: bold;" | RGB Value




=== Example  ===
|-
| colspan="1" rowspan="1" style="vertical-align: top; color: black; font-weight: normal;" | Black
| colspan="1" rowspan="1" style="vertical-align: top; color: black; font-weight: normal;" | 000000


|-
| colspan="1" rowspan="1" style="vertical-align: top; background-color: grey; color: white; font-weight: normal;" | White
| colspan="1" rowspan="1" style="vertical-align: top; color: black; font-weight: normal;" | 000000


|}
[[Category:ODB Tree]]





Revision as of 16:27, 2 July 2014

Links

Purpose

The /Custom ODB tree is required if the user wishes to create mhttpd custom pages. It contains essential data needed for mhttpd to display a custom page. The /images subtree is required if an imagefile (*.gif) is to be displayed on the custom page.

Creating the /Custom tree

The /Custom ODB tree is an optional tree that may be created by the user.


Example

The following example using the [[odbedit] ls command shows the optional custom tree for an experiment. Note the use of the "&" character to force the custom pages to be opened in the same frame, and the "!" key to suppress the custom-button from appearing on the mhttpd status page [local:pol:S]/ls -lr /Custom [local:pol:S]/custom>ls -rl

Key name                        Type    #Val  Size  Last Opn Mode Value
---------------------------------------------------------------------------
custom                          DIR
   ppg_cycle!                  STRING  1    80    36h  0  RWD  /home/pol/online/pol/custom/pol.html
   ppg_cycle&                  STRING  1    80    36h  0  RWD  /home/pol/online/pol/custom/pol_sc.html
   pol_functions!              STRING  1    80    36h  0  RWD  /home/pol/online/pol/custom/pol_functions.js
   style!                      STRING  1    80    36h  0  RWD  /home/pol/online/pol/custom/style.css
   images                      DIR
       pol_sc.gif              DIR
           background          STRING  1     80    36h  0   RWD  /home/pol/online/pol/custom/pol_sc.gif
           labels              DIR
               num bins        DIR
                   Src         STRING  1     256   36h  0   RWD  /Equipment/pol_acq/settings/output/num bins per cycle
                   Format      STRING  1     32    36h  0   RWD  %d
                   Font        STRING  1     32    36h  0   RWD  Medium
                   X           INT     1     4     36h  0   RWD  315
                   Y           INT     1     4     36h  0   RWD  502
                   Align       INT     1     4     36h  0   RWD  0
                   FGColor     STRING  1     8     36h  0   RWD  FFFFFF
                   BGColor     STRING  1     8     36h  0   RWD  0000FF
               dwell time      DIR
                   Src         STRING  1     256   36h  0   RWD  /Equipment/POL_ACQ/Settings/input/dwell time (ms)
                   Format      STRING  1     32    36h  0   RWD  %f ms
                   Font        STRING  1     32    36h  0   RWD  large
                   X           INT     1     4     36h  0   RWD  145
                   Y           INT     1     4     36h  0   RWD  430
                   Align       INT     1     4     36h  0   RWD  0
                   FGColor     STRING  1     8     36h  0   RWD  FFFFFF
                   BGColor     STRING  1     8     36h  0   RWD  0000FF


Keys in the /Custom tree

The optional ODB /Custom tree may contain

  • links to local external custom web pages created by the user (see below for remote external pages)
  • links to internal webpages
  • images subtree used to specify images for custom pages

If keys are defined in this tree, except where noted below, the names of the keys will appear as custom-buttons on the mhttpd Status page. By clicking on one of these custom-buttons, the custom page will be visible in a new frame (see also Key names).

The user chooses the names of any keys in the /Custom ODB tree except for

There are two characters that have special meaning if they are the last character of a Key name in the /Custom tree :

    • The character "&" forces the page to be opened within the current frame when the custom-button is pressed. If this character is omitted, the page will be opened in a new frame.
    • The character "!" suppresses the custom-button from appearing on the main status page (hidden-link).

Neither of these characters will appear in the name of the button.

The hidden-link feature can be used to provide external webpages hidden from the user, such as a stylesheet or a file of Javascript functions needed by other custom pages.


Images subtree

  • Type: DIR

This optional subtree in the /Custom ODB tree is created by the user. It is required if an imagefile (*.gif) is to be displayed on a custom page. This subtree is also required for any labels, bars or fills to be superimposed on the image.




<Image-name> subtree

  • Type: DIR
  • Default:

User-created subdirectory named for the corresponding gif-image, e.g. "pol_sc.gif" in the example above. For multiple images, multiple subdirectories may be defined.




Background

  • Type: STRING
  • Default:

This key in the <image-name> subtree contains the path and filename of the image file to be loaded into a custom page. Only gif format is supported for the image. This optional key is created by the user.





Labels subtree

  • Type: DIR
  • Default:

User-created subdirectory in the <image-name> subtree required if labels are to be superimposed on an image on a custom page.



<label-name> subtree

  • Type: DIR
  • Default:

User-created subdirectory in the Labels subtree containing keys to define this label as listed below. There will be a <label-name> subtree for each label superimposed on the custom image.

The user creates keys in this subtree with the names and types as listed below. See also the example above.



Src

  • Type: STRING
  • Default:

This key in the <label-name> subtree contains the path of a valid ODB Key variable. This is the value to be used for this label on an image.





Format

  • Type: STRING
  • Default:

This key in the <label-name> subtree contains the format for this label on the image. Format specifications (c.f. "printf" in C) are used to convert the value specified by the Src key into the output string that appears on the image. For example,

  • "Count Rate:%5d kB/s" used to display an integer value
  • "%5.2f%% iBu" used to display a floating point value. Note "%%" displays the "%" sign.






Font

  • Type: STRING
  • Default:

This key in the <label-name> subtree contains the font size for this label. Supported values are "small", "medium" or "giant".






X

  • Type: INT
  • Default:

This key in the <label-name> subtree contains the X position for this label in pixels.




Y

  • Type: INT
  • Default:

This key in the <label-name> subtree contains the Y position for this label in pixels.





Align

  • Type: INT
  • Default:

This key in the <label-name> subtree contains an integer representing Horizontal Alignment for this label. Set to one of 0 (left), 1 (center) or 2 (right).





FGColor

  • Type: STRING
  • Default:

This key in the <label-name> subtree contains the foreground colour for this label in the format RRGGBB (hex). See colour table.






BGColor

  • Type: STRING
  • Default:

This key in the <label-name> subtree contains the background colour for this label in the format RRGGBB (hex). See colour table.






Fills/span> subtree

  • Type: DIR
  • Default:

User-created subdirectory in the <image-name> subtree required if fills are to be superimposed on an image on a custom page.





Bars/span> subtree

  • Type: DIR
  • Default:

User-created subdirectory in the <image-name> subtree required if bars are to be superimposed on an image on a custom page.






Colour Table

Colour RGB Value


Black 000000
White 000000