available macro table, macro documentation work
This commit is contained in:
parent
6a7d14e24c
commit
8ea183be00
3 changed files with 52 additions and 4 deletions
|
|
@ -10,8 +10,9 @@ our $I18N = {
|
|||
'can edit text body' => {
|
||||
message => q|
|
||||
|
||||
<b>^CanEditText();</b><br>
|
||||
Display a message to a user that can edit the current page.
|
||||
<b>^CanEditText(<i>text message</i>);</b><br>
|
||||
Display a message to a user that can edit the current page. The message can be
|
||||
HTML or WebGUI Macros.
|
||||
<p>
|
||||
<i>Example:</i> ^CanEditText(^AdminToggle;);
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -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 '', '<tr><td>', $_, '</td><td>',
|
||||
($macros{$_} ? ('^', $macros{$_}, '();') : ' '),
|
||||
'</td></tr>' }
|
||||
@macros;
|
||||
|
||||
$macro_table =
|
||||
join("\n",
|
||||
'<table border="1" cellpadding="3">',
|
||||
'<tr><th>',WebGUI::International::get('macro name', 'Macros'),
|
||||
'</th><th>',
|
||||
WebGUI::International::get('macro shortcut', 'Macros'),
|
||||
'</th></tr>',$macro_table,'</table>');
|
||||
|
||||
|
||||
$I18N = {
|
||||
|
||||
%{ $I18N },
|
||||
|
||||
'macros list title' => {
|
||||
message => q|Macros, List of Available|,
|
||||
lastUpdated => 1112395935,
|
||||
},
|
||||
|
||||
'macros list body' => {
|
||||
message => q|<P>The set of available Macros is defined in the WebGUI configuration file. These Macros are available for use on your site:</P>|,
|
||||
message => q|<P>The set of available Macros is defined in the WebGUI configuration file. These Macros are available for use on your site:</P>|.$macro_table,
|
||||
context => 'Content for dynamically generated macro list',
|
||||
lastUpdated => 1112560683,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue