From 63baed9d27495065378d7c5447b7a65ff4b4c137 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Wed, 20 Jul 2005 10:04:07 +0000 Subject: [PATCH] documented status messages --- lam/docs/devel/FAQ.htm | 40 +++++++++++++++++++++++++++++++++++ lam/docs/devel/other_libs.htm | 7 ++++++ lam/lib/status.inc | 38 ++++++++++++++++++--------------- 3 files changed, 68 insertions(+), 17 deletions(-) diff --git a/lam/docs/devel/FAQ.htm b/lam/docs/devel/FAQ.htm index 64430144..82ab6ea1 100644 --- a/lam/docs/devel/FAQ.htm +++ b/lam/docs/devel/FAQ.htm @@ -58,6 +58,46 @@ really logged in and not calling the scripts by hand?
successfully logged in to LAM the variable $_SESSION['loggedIn'] is set to true.
+
+
+
+Q: What is the command for these error/warning/info messages?

+
+A: Your script must +include status.inc (automatically included for account +modules) to display these messages.
+The command is StatusMessage(<type>, +<headline>, <text>[, <variables>]).
+
+Parameters:
+ +
+Format of special tags:
+ +
+
+
diff --git a/lam/docs/devel/other_libs.htm b/lam/docs/devel/other_libs.htm index 6b810542..4a280374 100644 --- a/lam/docs/devel/other_libs.htm +++ b/lam/docs/devel/other_libs.htm @@ -28,7 +28,14 @@ They allow to have translated descriptions of the most common attributes.

Status messages (status.inc)

+Status.inc provides the function StatusMessage() +which can be used to display error, warning and information messages.
+The function uses preg_replace() to convert the special tags to HTML +tags. The message variables are included with printf().

+The parameters of StatusMessage() +are described in the developer FAQ.

Tree view and schema browser

The files tree.inc and schema.inc contain functions which are needed by diff --git a/lam/lib/status.inc b/lam/lib/status.inc index 437706dc..f508decd 100644 --- a/lam/lib/status.inc +++ b/lam/lib/status.inc @@ -3,7 +3,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam) - Copyright (C) 2003 Michael Duergner + Copyright (C) 2003 - 2004 Michael Duergner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,23 +24,27 @@ $Id$ * LDAP Account Manager status messages. * * @author Michael Dürgner - * @version 0.5 * @package lib - * @copyright Copyright (C) 2003-2004 Michael Dürgner - * @license GPL */ /** * This function prints a short status message. It can be used to print INFO, * WARN and ERROR messages at the moment. + * + * The headline and text may be formated with special tags: + *
+ *
{bold}, {endbold}: All text between these tags is printed bold. + *
{color=#123456}, {endcolor}: All text between these tags is printed in the given color. + *
{link=http://nodomain.org}, {endlink}: A link with the given target is created. The link text is the text between the tags. * - * @param string The type of the message to be printed. It must be one of - * the following types: 'INFO', 'WARN' or 'ERROR'. Every other type will lead - * to an error message indicating an invalid message type. - * @param string The headline of the status message. - * @param string The text of the status message. It may be formatted with - * the syntax specified by the other functions in this file. - * @param array The variables that are used to replace the spacers in the + * @param string $MessageTyp The type of the message to be printed. It must be one of + * the following types: 'INFO', 'WARN' or 'ERROR'. + *
Every other type will lead to an error message indicating an invalid message type. + * @param string $MessageHeadline The headline of the status message. + *
It may be formatted with special color/link/bold tags. + * @param string $MessageText The text of the status message. + *
It may be formatted with special color/link/bold tags. + * @param array $MessageVariables The variables that are used to replace the spacers (%s) in the * submitted text. This parameter is optional. */ function StatusMessage($MessageTyp,$MessageHeadline,$MessageText,$MessageVariables = array()) { @@ -94,7 +98,7 @@ function StatusMessage($MessageTyp,$MessageHeadline,$MessageText,$MessageVariabl * * @access private * - * @param string The text that is used to search for replaceable strings. + * @param string $MessageString The text that is used to search for replaceable strings. * * @return string The processed text. */ @@ -107,7 +111,7 @@ function parseMessageString($MessageString) { * * @access private * - * @param string The text that is used to search for {bold} and {endbold} tags. + * @param string $text The text that is used to search for {bold} and {endbold} tags. * * @return string The submitted text with {bold} and {endbold} replaced with * the appropriate HTML tages and @@ -123,9 +127,9 @@ function boldText($text) { * * @access private * - * @param string + * @param string $text The text that is used to search for {color} and {endcolor} tags. * - * @return string + * @return string Input string with HTML-formatted color tags */ function colorText($text) { $pattern = "/\{color=#?([0-9,a-f,A-F]{6})\}([^{]*)\{endcolor\}/"; // Regular expression matching {color=#[HEX-Value]}[Text]{endcolor} or {color=[HEX-Value]}[Text]{endcolor} @@ -138,9 +142,9 @@ function colorText($text) { * * @access private * - * @param string + * @param string $text The text that is used to search for {link} and {endlink} tags. * - * @return string + * @return string Input string with HTML-formatted link tags */ function linkText($text) { $pattern = "/\{link=([^}]*)\}([^{]*)\{endlink\}/"; // Regular expression matching {link=[Link-Target]}[Text]{endlink}