Templates

Templates files provide sidvault flexibility in its web interface. The templates are used to generate the look and feel of the web interface to SIDVault for your customers. The templates are basically HTML code with our '||variables||'.

If you have any questions or need to know more about any aspect of SIDVault please Email:
 
sidvault@alphacentauri.co.nz
Template Files

Templates files provide sidvault flexibility in its web interface. The templates are used to generate the look and feel of the web interface to SIDVault for your customers. The templates are basically HTML code with our '||variables||'. The '||variables||' that are available are described in more details in Templates Variables.

Below is a list of the template files, and a brief description of what each is for. Each file has the option of  having a frame version, which has the same name with the suffix f for frames. For a frame login the frame.tpl is loaded and menubar.tpl is placed in the top frame.

Admin Templates

File Name Description
body.tpl This is the default page that is display once you login.
list.tpl This lists the available schemas.
log.tpl This displays the sidvault.log file using this templates.
login.tpl This is login page that is first page that you will see when you connect to the admin.cgi.
main.tpl This is the template that sets up all the frames.
memory.tpl This is the template showing hte memory alloctions within the internal database.
menu.tpl The available admin commands available.
reload.tpl The template that is display when the server is reloading all it's data.
schema.tpl The template that is used to display the schema information.
shutdown.tpl The template that is display when the server is shutting down.
status.tpl This is the basic stats of SIDVault.
suck.tpl This template is the form that is fillout when admins wish to suck data from other LDAP servers.
suck_display.tpl This tempalte is display when they is already a sucking feed currenty being processed.

User Templates

File Name Description
body.tpl This is the default page that is display once you login.
create.tpl This is used when creating a new DN record.
failed.tpl If an error occurs, this template will be displayed.
item.tpl This is display when you are viewing a record.
list.tpl This lists the available objects with the database.
login.tpl This is the login page that is dispay when the user wish to login using another account.
main.tpl This is the template that sets up all the frames.
menu.tpl The available user commands available.
modify.tpl This is the template that is display when the user wish to change an record.
modrn.tpl The template that is used to when a modrn command is requested.
ok.tpl When a successfull command it processed this tempalte is displayed.
search.tpl When the user is searching the LDAP database this templates is used.

There are other example sets of template files available. If you create a particularly nice set you might like to share them with others. If so, send them to sidvault@alphacentauri.co.nz and we will add them to this list.

CGI Commands

The template files contain ordinary html plus ||variables||. These variables are setup by the CGI commands and template commands. The CGI commands may take the form of a submit button with a particular name, a hidden cmd (or xcmd) field inside a form or as a query in the form cmd=xyz

Every CGI cmd can be setup as a button, hidden or as part of a query. When commands are setup as buttons there must be no hidden command field in the form or this will override the button.

eg.   
Button: <input type=submit name="xxxxxx" value="any thing">
Hidden Field: <input type=hidden name="cmd" value="xxxxxx">
Query: <a href="||action||?cmd=xxxxxx&utoken=||utoken||">any thing</a>

The list of valid CGI commands is show below. This list also shows which default template is displayed. The input and output variables that are needed/setup are also displayed for each command. In addition, some commands change user settings, and these are also displayed.

Any variable in the lists that start with a '~' is an ini setting.

Admin Commands

CMD Function Template
login
This will display the login page. (admin/login.tpl)
preform_login This will login a user. (admin/main.tpl)
list_schema This will list the current available schemas. (admin/list.tpl)
status This will display SIDVault status information (admin/status.tpl)
setup This will display SIDVault setup information. (admin/setup.tpl)
suck This will display the sucking.

(admin/suck.tpl)

new_suck This will add a new sucking rule. (admin/suck.tpl)
do_suck This will list the current available schemas. (admin/suck.tpl)
schema This will list the current available schemas. (admin/schema.tpl)
conn_off This will shutdown a socket connection to SIDVault. (admin/status.tpl)
log Will display teh sidvault.log file. (admin/log.tpl)
memory This will display all the memory allocation within the database. (admin/memory.tpl)
shutdown This will shutdown SIDVault. (admin/shutdown.tpl)
reload This will reload SIDVault, picking up any schema and sidvault.ini changes. (admin/reload.tpl)

User Commands

CMD Function Template
login
This will display the login page. (user/login.tpl)
preform_login This will login a user. (user/main.tpl)
show This allows you to state which page to display. (page)
list This will display the list of recorded available. (user/list.tpl)
item This will display teh selected record.

(user/item.tpl)

create This will display the template allowing you to create a new record. (user/create.tpl)
modify Allows you to modify the selected item. (user/modify.tpl)
modrn Allows you to modrn the selected item. (user/modrn.tpl)
do_create This will create the new record. (user/item.tpl)
do_delete This will remove the selected record. (user/item.tpl)
do_modify This will save the modified data. (user/item.tpl)
do_modrn This will preform the modrn command. (user/item.tpl)
search This allows the user to search within the database. (user/search.tpl)
do_search This will preform the search. (user/search.tpl)
Template Commands

Throughout the templates you will see '||commands||'. These are what the CGI will pick up and replace with data. Some commands set up variables and are only available on one page. Other variables are available on all templates.

There are also conditional statements and functions available. The following tables show all of the available '||commands||'. In the tables, some commands have extra fields, in which case the name of the field will show one of the following:

  • 'var' - a variable name.
  • 'value' - either a variable or text.
  • 'text' - just text.

The below template commands are available on every template:

Table of Contents

Tables

Conditional Statements

The below conditional statements are available on every template.

||ifndef||sound||
        ....Show Picture instead...
||else||
   ||ifequal||sound||loud||
                ...play loud sound file...
   ||else||
             ||ifequal||sound||normal||
                    Play sound file...
             ||endif||
   ||endif||
||endif||

||ifdef||var|| Conditional inclusion if variable is defined.
||ifndef||var|| Conditional inclusion if variable is not defined.
||ifinstr||value1||value2|| Conditional inclusion if template variable value1 contains string value2, case sensitive.
||iflower||value1||value2|| This will return to true if 'value1' is lower than 'value2'.
||ifequal||value1||value2|| Conditional inclusion if template value1 equals value2, case sensitive.
||ifnequal||value1||value2|| Conditional inclusion if template value1 not equals value2, case sensitive.
||ifgreater||value1||value2|| This will return to true if 'value1' is greater than 'value2'.
||else|| Optional ||else|| section to go with any of the ||if...|| conditions.
||endif|| Marks end of any ||if...|| or ||else|| section. Must have an ||endif|| for every ||if...||.

 

Template Commands
||define||var||value|| This will create a variable with the stated value.
||undef||var|| This will undefine a variable.
||include||template|| This reads the named file, which may include template variables.
ie.  ||include||menubar.tpl||
||do(....)|| This is used to run other command line scripts, including CGI's, scripts and other compiled code.

NOTE: This will remove the 'Content-Type:' of other CGI's.
Variables may also be used as a parameter.
ie.  ||do(program.cgi ||current_user|| ||current_host||)||

NOTE: This requires the "do_base_dir" ini setting to be used.

||build(...)|| This allows the building of variables from variables in order to display their value.

||define||first||nw||
||define||second||img||
||build(||first||||second||)||
or
||build(NW||second||)||

The above will display the value for the variable 'nwimg' if one is available.

||lang||var|| This takes a variable and translates the value using the language file.
ie.   ||Define||test||welcome||
       ||Lang||test||
||lang_str||text|| This takes text and translates it using the language file.
ie.   ||lang_str||INBOX||
||chop||var||n|| This performs a chop of the variable's value, where it only displays n number of characters.
||lchop||var||n|| This will chop the variable to the size provided, chopping at whole word intervals, and adding on '...' if chopped.
||chop_str||text||n|| This performs a chop of the text or the name of the variable, where it only displays n number of characters.
||lchop_str||text||n|| This will chop the text to the size provided, chopping at whole word intervals, and adding on '...' if chopped.
||is_checked||var|| This will replace with 'checked' if the value of the variable is on, true, checked or a  non zero number.
||java_text||var|| This will convert the variable to use '_' for the following characters so that you can use the value as a javascript variable.
                         '(space)', '+', '<', '>', '&', ':'
||href_text||var|| This will convert the variable to use '%xx' for the following characters when using javascript and href's:
                         '(space)', '+', '<', '>', '&', ':'
This will only encode the first 1024 characters. This is acceptable in most cases as most browsers have a limit near list on all queries (href's).
||html_text||var|| This will convert the variable into displayable HTML characters. This ensures that it will not be treated as an actual HTML. It converts the following characters:
                         '"', '<', '>', '&', '\n', '\r' also language support etc.
||html_line||var|| This works as above, but will not remove the '\n' and '\r's.
||wml_text||var|| This will convert the variable so that it  displays correctly in WML.
||wml_line||var|| This works as above, except that it will not remove '\n' and '\R's
||wml_line||text|| This will convert the text so that it  displays correctly in WML.
||wml_br_text||var|| This works the same as the variable 'wml_text', except that this variable might have WML code and so is left alone.
||wml_br_line||var|| This works as above, except that it will not remove '\n' and '\R's
||wml_str||text|| This will convert the text so that it displays correctly in WML.
||date_today||value|| This displays today's date in the specified layout, or using the variable provided.
ie.   ||date_today||date_layout||
||add||var1||var2|| Adds 2 integers and displays the result.
||sub||var1||var2|| Subtracts the integer var2 from integer var1 and displays the result.
||remove_email||var1||var2|| Template function, used to remove a particular email address out of a list. Used: ||remove_email||list_of_emails||email_to_remove||
||just_include||varaible|| Like the ||include|| template function however, using this command the file will not be phased through the template phaser, it will be displayed as is.

 

Extended Template Commands

The below template commands are available on every template.

||/*||...||*/|| Anything between these tags will not be passed out to the web server. This is so that internal comments can be setup that the user cannot see.
||version|| The version number, eg: "v1.0a"
||product|| The product name ("SIDVault")
||env||value|| This returns the environment variable of the value
||display_log||
This will display 'sidvault.log' file
||display_suck_log||
This will display the information about the last sucking log.

 

Begin...End Commands

Most of the following commands require some variables to be setup in order for them to be used correctly. All 'begin...end' commands set up various variables inside them, and normally generate multiple results. The main example is the list begin..end command, where it is displayed for every message on the page.

Any variable in the input list that starts with a '~' is an ini setting.

||begin_tree||...||end_tree|| This will build the tree information from the availabel records with in the database.
Input Variables:
tree_start The basae location were the start the tree.
tree_span_limit
tree_limit
The max limits of the tree.
Output Variables:
tree_end Set to 'true' when the tree has reached the end.
tree_line The line number of the tree.
tree_depth The depth of the tree.
tree_dn
tree_parent
tree_top
The DN of the tree node. (dn=lynden,dc=example,dc=com)
The parent dn of the tree node.(dc=example,dc=com)
The top DN of the tree node. (dn=lynden)
tree_object The ClassObject type of the node (person)
||begin_item||...||begin_item|| This will display the labels and values of the record.
Input Variables:
dn The DN of the object to display.
Output Variables:
object_label The label of the object
object_value The value of the object.
object_access_denied Set to true if you are not allowed access to this object.
||begin_structure||...||end_structure|| This will display the ClassObject of the select object.
Input Variables:
dn The DN of the object to display.
Output Variables:
struct_name The ClassObject of the object.

||begin_requires||...||end_requires||
||begin_allows||...||end_allows||

Display the required and allowed labels for the selected structures.
Input Variables:
structure The list of ClassObjects to display.
Output Variables:
object_value
object_label
The label and value of the object.
sv_id
sv_name
sv_type
The id, name and type of structure.

sv_size
sv_single
sv_match_case
sv_match
sv_coded
sv_admin
sv_system
sv_match
sv_count

The flags setup on the object.
||begin_schema||...||end_schema|| This lists the available schemas
Output Variables:
schema_name The name of the schema.
||begin_schema_list||...||end_schema_list|| This lists the schemas of the selected object.
Input Variables:
structure The structure to use.
Output Variables:
schema_name The name of the schema.
||begin_search||...||end_search|| This will display the search results.
Input Variables:
dn The DN of the object to display.
limit The max number of objects to display
or Wither or not the conditions are OR'ed or AND'ed.
scope The scope of the search (wholeSubtree or singleLevel)
label_*
value_ *
The search parameters.
Output Variables:
tree_dn
tree_parent
tree_top
The DN of the tree node. (dn=lynden,dc=example,dc=com)
The parent dn of the tree node.(dc=example,dc=com)
The top DN of the tree node. (dn=lynden)
tree_object The ClassObject type of the node (person)

The following commands are ONLY available with the 'admin.cgi'
||begin_module||...||end_module|| This will list the active modules currently running in SIDVault
Output Variables:
module_started The date the module was successfully started.
module_type The type of module (ie ldap, http, manager)
module_ip
module_port
The IP and port the module is listening on.
module_max The max number of connections allowed to this module.
module_conn The total number of connections made since the module was started.
module_current The current number of connections to this module.
||begin_failed_module||...||end_failed_module|| This will list the modules that have failed to be setup.
Output Variables:
module_failed The module information that failed.
||begin_connection||...||end_connection|| This will list the connections currently to the SIDVault.
Output Variables:
conn_started When the connection was made.
conn_in Amount of data received.
conn_out Amount of data sent.
conn_tid

The connection thread ID.

conn_remote The remote IP that made the connection.
conn_local The local IP they connected on.
conn_state The current state of the connection.
||begin_bins||...||end_bins|| This will list the data bins that are available in SIDVault..
Output Variables:
bin_num The Bin Number
bin_loaded If the bin is loaded into memory.
bin_lock If the bin is currently locked.
bin_size

The size of the overall bin. (Including slack space)

bin_clear The amount of slack space.
bin_clear_num The amount of fragments of slack space.
bin_records The amount of records store in this bin.
bin_read The number of modules that are currently reading data from this bin.
bin_file The physicall location of the bin file.
||begin_schema_fields||...||end_schema_fields|| The list of fields currently available inside the database.
Output Variables:
field_extra The flags this field has setup.
field_id The id of the field.
field_name The name of the field.
field_size

The size of the field.

field_search The number of times this field has been searched on.
field_type The type of field.
||begin_schema_struct||...||end_schema_struct|| The list of scheams currently available inside the database.
Output Variables:
struct_id The id of the schema.
struct_name The name of the schema.
struct_system

Number of fields setup as system.

struct_requires Number of fields setup as required.
struct_allowed Number of fields setup as allowed.