XIX. Snippetdirs Reference

Midgard uses code snippets and snippetdirs for handling library-like code in a format that enables sharing the code between hosts. Code snippets are stored in snippetdir tree hierarchies within the Midgard database.

1. Snippetdir Record Definition

A snippetdir record contains information about a snippetdir and its parent.

Fields of a snippetdir record

id

The id of the snippetdir record.

up

The id of the parent snippetdir.

name

The name of the snippetdir record.

description

The description of the snippetdir record.

owner

The group id of the owner of th Snippetdir.

sitegroup

The id of the sitegroup de snippetdir record belongs to.

2. Snippetdir Object Definition

This section describes the content of a snippetdir object. Most object parameters map directly to the record fields described above.

The functions listed within the object definition are the object methods that are available for the object. Usage information about those methods can be found in Object Methods.

/* Snippetdir Object Prototype */

Class snippetdir {

  var $N;         # Only with mgd_list_XXX functions.
  var $id;
  var $up;
  var $name;
  var $description;
  var $sitegroup;

  function fetch();    # Only with mgd_list_XXX functions.

  function create();
  function update();
  function delete();

  function createattachment();
  function updateattachment();
  function deleteattachment();
  function getattachment();
  function listattahcments();
  function openattachment();
  function serveattachement();

  function listparameters();
  function parameter();
  function searchparameters();
 
  function getsitegroup();
  function setsitegroup();

}
Table of Contents
mgd_get_snippetdir — Get a snippetdir
mgd_get_snippetdir_by_path — Get snippetdir by its path
mgd_create_snippetdir — Create a snippetdir
mgd_delete_snippetdir — Delete a snippetdir
mgd_update_snippetdir — Update a snippetdir
mgd_copy_snippetdir — Copy a snippetdir
mgd_is_snippetdir_owner — Check snippetdir ownership
mgd_list_snippetdirs — List snippetdirs