Midgard 1.4

Jean-Pierre Arneodo

Henri Bergius

Alexander Bokovoy

Mark Constable

Dariusz Debowczyk

David Guerizec

Emiliano Heynz

Simon Kerr

Jonni Lehtiranta

Cedric Musso

Ron Parker

Joost Soeterbroek

Marius Ndemeno Tegomoh

Carilda Thomas

Jamie Tomlinson

Armand Verstappen

Jukka Zitting

Copyright © 2000 Aurora (http://www.aurora-linux.com) - Midgard Ry, Ron Parker, Armand Verstappen. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with the Invariant Sections being copyright page, GFDL license, and preface, with the Front-Cover Texts being no Front-Cover Texts, and with the Back-Cover Texts being no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and Midgard Projects Ry was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher assumes no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.


Dedication

This book is dedicated to Midgard Project Ry and the Open Source community.

Table of Contents
Preface
Introduction
1. Features; Publishing, Development, Deployment
2. Documentation, Mailing Lists
3. System Requirements
4. Licensing
5. Midgard Project Ry
6. Road Map
I. Installation from Source
1. Midgard Installation Guide
1.1. Minimum System and Software Requirements
1.2. Document Conventions
1.3. Installation Overview
1.4. Apache Installation
1.5. MySQL Installation
1.6. Glib Installation
1.7. Expat-lib Installation
1.8. Midgard Libraries (midgard-lib-1.4 Installation)
1.9. Midgard Database Installation
1.10. Midgard Apache Module
1.11. Midgard-php3 Installation
1.12. Midgard-php4 Installation
1.13. Apache Configuration File Edit
1.14. Updating the Midgard Database
1.15. Getting Started
II. Concepts and Features
Abstract
Typographical Conventions
2. Database Backend, Midgard Functions
3. Host, URL and Dynamic Page Parameters
4. Templating System and page construction: Pages and Styles
4.1. Elements
4.2. Inheritance
4.3. Page construction, midgard-root.php3
4.4. Predefined Elements
4.5. A typical example
5. Graph structure for Pages: Pagelinks
6. Content Management, Topics and Articles
7. Formatting Engine
8. SiteGroups: Virtual Database Environment, Authentication
8.1. Sitegroups
8.2. Authentication and Security
9. Managing Users
9.1. Read Access
9.2. Write Access
9.3. Users, and Articles authors and lockers
9.4. Pagelinks
9.5. Preferences
10. Personalization
10.1. Personalization
10.2. Usage examples
10.3. Case: Storing time of last visit
10.4. Setting the timestamp
10.5. Showing last visit information
10.6. Showing updated news items
11. Code Snippets
12. Calendaring
13. Blob serving, Attachments
14. Replication with Repligard
14.1. Features
14.2. How it works
14.3. How to use it
15. Filetemplates, Serving from the File System - BETA
16. Multi-Databases, Alternative to SiteGroups - ALPHA
Glossary
III. Architecture and Data Flow
17. Midgard's Components
18. Data Flow
IV. Function Reference
Usage Guide
I. Object Methods
$object->fetch — Fetch a record
$object->create — Create a record
$object->update — Update a record
$object->delete — Delete a record
$object->getsitegroup — Get the sitegroup a record belongs to
$object->setsitegroup — Set the sitegroup a record belongs to
$object->parameter — Set or get a record parameter
$object->listparameters — List the parameters/parameter domains for a record
$object->searchparameters — Search record parameters
$object->setscore — Set the score of a record
$object->settype — Set the type of a record
$object->createattachment — Create a record attachment
$object->updateattachment — Update a record attachment
$object->deleteattachment — Delete a record attachment
$object->getattachment — Get a record attachment
$object->listattachments — List the attachments to a record
$object->openattachment — Open a filehandle to an attachment
$object->serveattachment — Serve a record attachment
$object->stat — Gives information about an attachment
II. Article Reference
mgd_approve_article — Approve/unapprove an article
mgd_copy_article — Copy an article
mgd_create_article — Create a new article
mgd_delete_article — Delete an article
mgd_get_article — Get an article
mgd_get_article_by_name — Get an article by its name
mgd_get_reply_by_name — Get a reply by its name
mgd_is_article_in_topic_tree — Check location within a topic tree
mgd_is_article_owner — Check article ownership
mgd_list_reply_articles — List articles in reply of an article
mgd_list_topic_articles — List articles under topic
mgd_list_topic_articles_all — List articles under topic tree
mgd_list_topic_articles_all_fast — List articles under topic tree
mgd_list_topic_articles_all_of_person — List articles under topic tree owned by a person
mgd_list_topic_calendar_all — List articles under topic (sub)tree in a time window
mgd_list_topic_calendar_all_fast — List articles under topic (sub)tree in a time window
mgd_list_topic_persons — List persons of a topic
mgd_list_topic_persons_all — List persons of a topic tree
mgd_move_article — Move an article to different topic
mgd_move_reply — Move a reply article to a different parent article
mgd_toggle_article_lock — Toggle the locked/unlocked state of an article
mgd_update_article — Modify an article
mgd_update_article_created — Update the creation date of an article
mgd_update_article_replyto — Link one article to another
mgd_update_article_score — Set the score of an article
mgd_update_article_type — Set the type of an article
III. Attachment Reference
mgd_delete_attachment — Delete an attachment
mgd_get_attachment — Get an attachment
mgd_open_attachment — Open a filehandle to an attachment
mgd_serve_attachment — Serve an attachment
mgd_update_attachment — Update an attachment
mgd_stat_attachment — Gives information about the attachment.
IV. Element Reference
mgd_copy_element — Copy a style element
mgd_create_element — Create an element record
mgd_delete_element — Delete an element record
mgd_get_element — Retrieve information about an element
mgd_get_element_by_name — Retrieve information about an element by its name
mgd_list_elements — List elements of a style
mgd_move_element — Move an element
mgd_update_element — Modify an element record
V. Eventmember Reference
mgd_count_event_members — Count eventmembers
mgd_create_event_member — Create an eventmember record
mgd_delete_event_member — Delete an eventmember
mgd_get_event_member — Get an eventmember record
mgd_list_event_members — List eventmembers
mgd_update_event_member — Update an eventmember record
VI. Event Reference
mgd_get_event — Get an event record
mgd_create_event — Create a new event record
mgd_delete_event — Delete an event record
mgd_update_event — Update an event record
mgd_copy_event — Copy an event
mgd_move_event — Move an event to different event
mgd_is_event_owner — Check event ownership
mgd_count_events_in_month — Count the events in a month
mgd_count_events_in_period — Count the events in a period
mgd_list_events — List event records
mgd_list_events_all — List event records under event tree
mgd_list_events_between — list event records between two timestamps
VII. Group Reference
mgd_create_group — Create a group
mgd_delete_group — Delete a group
mgd_get_group — Get a group record
mgd_get_group_by_name — Get a group record by its name
mgd_is_group_owner — Check group ownership
mgd_list_groups — List groups
mgd_update_group — Update a group record
VIII. Host Reference
mgd_get_host — Get a host record
mgd_get_host_by_name — Get a host by its name
mgd_create_host — Create a host record
mgd_delete_host — Delete a host record
mgd_update_host — Update a host record
mgd_is_host_owner — Check host ownership
mgd_list_hosts — List midgard hosts
IX. Member Reference
mgd_create_member — Create a member record
mgd_delete_member — Delete a member record
mgd_get_member — Get a member record
mgd_is_member — Check group membership
mgd_list_members — List members
mgd_list_memberships — List group memberships
mgd_update_member — Update a member record
X. Other Functions
mgd_get_midgard — Entry point to the midgard system
mgd_auth_midgard — Authenticate a user
mgd_create_mail — Send a mail message
mgd_errno — Get latest error code
mgd_errstr — Get error code description
mgd_get_social_life — Get a social life
repligard — imports/export Midgard resources to/from an xml-dump
mgd_version — Get version info
XI. Page Reference
mgd_get_page — Get a page record
mgd_get_page_by_name — Get a page record by its name
mgd_create_page — Create a page record
mgd_delete_page — Delete a page record
mgd_delete_page_tree — Delete a page tree
mgd_update_page — Update a page record
mgd_move_page — Move a page
mgd_copy_page — Copy a page record
mgd_is_page_owner — Check page ownership
mgd_is_in_page_tree — Check residance within pagetree
mgd_list_pages — List page records
mgd_page_has_children — Check if page has children
mgd_walk_page_tree — Walk a page tree
XII. Page Element Reference
mgd_copy_page_element — Copy a page element
mgd_create_page_element — Create a page element
mgd_delete_page_element — Delete a page element record
mgd_get_page_element — Get a page-element record
mgd_get_page_element_by_name — Get a page-element record by name
mgd_list_page_elements — List page elements
mgd_move_page_element — Move a page element
mgd_update_page_element — Update a page element record
XIII. Pagelink Reference
mgd_create_pagelink — Create a pagelink
mgd_delete_pagelink — Delete a pagelink
mgd_get_pagelink — Get a pagelink
mgd_get_pagelink_by_name — Get a pagelink by name
mgd_list_pagelinks — List pagelinks
mgd_update_pagelink — Update a pagelink record
XIV. Parameters Reference
XV. Person Reference
mgd_copy_person — Copy a person record
mgd_create_person — Create a person record
mgd_delete_person — Delete a person
mgd_get_person — Get a person
mgd_list_persons — List person records
mgd_list_persons_in_department — List persons linked to a department
mgd_list_persons_in_department_all — List persons linked to a department topic tree
mgd_list_persons_in_office — List persons linked to a office topic
mgd_update_person — Update a person record
mgd_update_password — Change username and password of a person
mgd_update_password_plain — Change username and plain text password of a person
mgd_update_public — Declare personal information public/hidden
XVI. Preference Reference
mgd_create_preference — Create a preference record
mgd_delete_preference — Delete a preference record
mgd_get_preference — Get a preference
mgd_list_preferences — List preferences
mgd_update_preference — Update a preference
XVII. Sitegroup Reference
mgd_create_sitegroup — Create a sitegroup record
mgd_delete_sitegroup — Delete a sitegroup
mgd_get_sitegroup — Get a sitegroup
mgd_has_sitegroups — Check if Midgard has sitegroups
mgd_list_sitegroups — List sitegroups
mgd_update_sitegroup — Update a sitegroup
XVIII. Code Snippets Reference
mgd_create_snippet — Create a snippet
mgd_delete_snippet — Delete a snippet
mgd_get_snippet — Get a snippet
mgd_get_snippet_by_name — Get a snippet by its name
mgd_include_snippet — Include a snippet
mgd_list_snippets — List snippets
mgd_update_snippet — Update a snippet
XIX. Snippetdirs Reference
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
XX. Style Reference
mgd_copy_style — Copy a style
mgd_create_style — Create a style
mgd_delete_style — Delete a style record
mgd_delete_style_tree — Delete a style tree
mgd_get_style — Get a style
mgd_get_style_by_name — Get a style by its name
mgd_list_styles — List style records
mgd_update_style — Update a style record
mgd_walk_style_tree — Walk a style tree
XXI. Topic Reference
mgd_copy_topic — Copy a topic
mgd_create_topic — Create a new topic
mgd_delete_topic — Delete a topic
mgd_delete_topic_tree — Delete a topic tree
mgd_get_topic — Get a topic
mgd_get_topic_by_name — Get a topic by its name
mgd_is_in_topic_tree — Check location within a topic tree
mgd_is_topic_owner — Check topic ownership
mgd_list_topics — List subtopics
mgd_move_topic — Move a topic
mgd_update_topic — Update a topic
mgd_update_topic_score — Change the score of a topic
mgd_walk_topic_tree — Walk a topic tree
A. On-line Support, Mailing Lists
A.1. Subscribing to the Lists
A.2. List Policies
A.3. List archives
B. GNU Free Documentation License
B.1. 0. PREAMBLE
B.2. 1. APPLICABILITY AND DEFINITIONS
B.3. 2. VERBATIM COPYING
B.4. 3. COPYING IN QUANTITY
B.5. 4. MODIFICATIONS
B.6. 5. COMBINING DOCUMENTS
B.7. 6. COLLECTIONS OF DOCUMENTS
B.8. 7. AGGREGATION WITH INDEPENDENT WORKS
B.9. 8. TRANSLATION
B.10. 9. TERMINATION
B.11. 10. FUTURE REVISIONS OF THIS LICENSE
List of Tables
8-1. Sitegroup login Delimiters for root level user root.
8-2. Sitegroup login Delimiters for admin level user admin.
8-3. Sitegroup login Delimiters for user level user user.
14-1. The Repligard table
1. Midgard Functions
1. Object methods
List of Figures
2-1. Entity-Relationship Diagram for Parameter.
4-1. The tree structures for Pages, Styles and Elements.
4-2. Entity-relationship Diagram for Pages, Styles, Page Elements, Style Elements and Host.
4-3. Page tree walk-down and Style tree walk-up ; the Inheritance mechanism
4-4. The midgard-root.php3 file
5-1. Entity-Relationship Diagram for Pagelink.
6-1. Entity-Relationship Diagram for Topic and Article.
9-1. Entity-Relationship Diagram for Person, Member, Group, Sitegroup and Preference.
9-2. Redirection to different Pages depending on Group membership with Pagelinks.
11-1. Entity-Relationship Diagram for Snippetdir and Snippet.
12-1. Entity-Relationship Diagram for Event and Eventmember.
13-1. Entity-Relationship Diagram for Attachment.
14-1. Sub-tree replication by Repligard
14-2. GUID Generation
14-3. Repligard Use
18-1. Architecture, Data Flow
List of Examples
3-1. A URL request for Midgard
4-1. A minimal typical <[ROOT]> Element and the resulting Page
5-1. A Pagelink Example
9-1. An example of Group, author and locker ownership