From 8ea183be009ad4087a3ed840237bc2590fe99899 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 4 Apr 2005 06:25:19 +0000 Subject: [PATCH] available macro table, macro documentation work --- lib/WebGUI/i18n/English/CanEditText.pm | 5 +-- lib/WebGUI/i18n/English/Macros.pm | 49 +++++++++++++++++++++++++- lib/WebGUI/i18n/English/a_account.pm | 2 +- 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/lib/WebGUI/i18n/English/CanEditText.pm b/lib/WebGUI/i18n/English/CanEditText.pm index 6c6e008ee..2db028324 100644 --- a/lib/WebGUI/i18n/English/CanEditText.pm +++ b/lib/WebGUI/i18n/English/CanEditText.pm @@ -10,8 +10,9 @@ our $I18N = { 'can edit text body' => { message => q| -^CanEditText();
-Display a message to a user that can edit the current page. +^CanEditText(text message);
+Display a message to a user that can edit the current page. The message can be +HTML or WebGUI Macros.

Example: ^CanEditText(^AdminToggle;);

diff --git a/lib/WebGUI/i18n/English/Macros.pm b/lib/WebGUI/i18n/English/Macros.pm index e03408be8..9474d6c4b 100644 --- a/lib/WebGUI/i18n/English/Macros.pm +++ b/lib/WebGUI/i18n/English/Macros.pm @@ -1,13 +1,60 @@ package WebGUI::i18n::English::Macros; +use WebGUI::Session; +use WebGUI::International; + our $I18N = { + + 'macro name' => { + message => q|Macro Name|, + lastUpdated => 1112591288 + }, + + 'macro shortcut' => { + message => q|Macro Shortcut|, + lastUpdated => 1112591289 + }, + +}; + +##Get list of all macros by namespace/module name +my $dir = join $session{os}{slash}, $session{config}{webguiRoot},"lib","WebGUI","Macro"; +opendir (DIR,$dir) or WebGUI::ErrorHandler::fatal("Can't open Macro directory: $dir!"); +my @macros = map { s/\.pm//; $_; } + grep { /\.pm$/ } + readdir(DIR); ##list of namespaces +closedir(DIR); + +##Build list of enabled macros, by namespace by reversing session hash: +my %macros = reverse %{ $session{config}{macros} }; + +$macro_table = + join "\n", + map { join '', '', $_, '', + ($macros{$_} ? ('^', $macros{$_}, '();') : ' '), + '' } + @macros; + +$macro_table = + join("\n", + '', + '',$macro_table,'
',WebGUI::International::get('macro name', 'Macros'), + '', + WebGUI::International::get('macro shortcut', 'Macros'), + '
'); + + +$I18N = { + + %{ $I18N }, + 'macros list title' => { message => q|Macros, List of Available|, lastUpdated => 1112395935, }, 'macros list body' => { - message => q|

The set of available Macros is defined in the WebGUI configuration file. These Macros are available for use on your site:

|, + message => q|

The set of available Macros is defined in the WebGUI configuration file. These Macros are available for use on your site:

|.$macro_table, context => 'Content for dynamically generated macro list', lastUpdated => 1112560683, }, diff --git a/lib/WebGUI/i18n/English/a_account.pm b/lib/WebGUI/i18n/English/a_account.pm index b4099e687..004928e1e 100644 --- a/lib/WebGUI/i18n/English/a_account.pm +++ b/lib/WebGUI/i18n/English/a_account.pm @@ -3,7 +3,7 @@ package WebGUI::i18n::English::a_account; our $I18N = { 'account title' => { - message => q|My Account Macro|, + message => q|Account Macro|, lastUpdated => 1112466408, },