From ff110de45cadc0a22a76995c609114f8421ab863 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Tue, 13 Jul 2004 17:11:06 +0000 Subject: [PATCH] various patches --- docs/changelog/6.x.x.txt | 3 +++ docs/upgrades/upgrade_6.0.3-6.1.0.sql | 3 ++- lib/WebGUI/Attachment.pm | 26 ++++++++++++++++---------- lib/WebGUI/Macro/Snippet.pm | 9 ++++++--- lib/WebGUI/i18n/English/WebGUI.pm | 20 ++++++++++---------- 5 files changed, 37 insertions(+), 24 deletions(-) diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index ad2e2ee9a..be538437f 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -83,6 +83,9 @@ - bugfix [ 977201 ] ws client bug - bugfix [ 969740 ] Messageboard: Deleting of postings - Added an option to sort a select list by its values. Thanks to Roy Johnson. + - RFE [ 960747 ] Make the attachment box templated. Thanks to Flavio Curti. + - Snippets can now take up to 9 optional parameters as replacements similar + to the SQL macro. Thanks to Andreas Ljunggren. 6.0.3 diff --git a/docs/upgrades/upgrade_6.0.3-6.1.0.sql b/docs/upgrades/upgrade_6.0.3-6.1.0.sql index 809d43fbd..9760e4467 100644 --- a/docs/upgrades/upgrade_6.0.3-6.1.0.sql +++ b/docs/upgrades/upgrade_6.0.3-6.1.0.sql @@ -15,5 +15,6 @@ INSERT INTO template VALUES (1,'Default Group Delete Macro','','Macro/H_homeLink',1,1); INSERT INTO template VALUES (1,'Default Make Printable','','Macro/r_printable',1,1); INSERT INTO template VALUES (1,'Default LoginToggle','','Macro/LoginToggle',1,1); - +INSERT INTO template VALUES (1, 'Attachment Box', '

\r\n \r\n \r\n \r\n \r\n
\r\n<tmpl_var attachment.name>\r\n<tmpl_var attachment.name>\r\n
\r\n

\r\n', 'AttachmentBox', 1, 1); + diff --git a/lib/WebGUI/Attachment.pm b/lib/WebGUI/Attachment.pm index 332b04e52..3ced07eb2 100644 --- a/lib/WebGUI/Attachment.pm +++ b/lib/WebGUI/Attachment.pm @@ -31,6 +31,7 @@ use WebGUI::ErrorHandler; use WebGUI::HTTP; use WebGUI::Node; use WebGUI::Session; +use Template; use WebGUI::URL; use WebGUI::Utility; @@ -83,20 +84,25 @@ These methods are available from this class: =head2 box ( ) -Displays the attachment in WebGUI's standard "Attachment Box". +Displays the attachment box template. + +Template-Variables: + attachment.icon + attachment.url + attachment.name + attachment.size + attachment.type =cut sub box { - my ($output); - $output = '

'. - ''.
-                $_[0]->getFilename.''.$_[0]->getFilename
-                .''.$_[0]->getFilename.'
'; - return $output; + my %var; + $var{"attachment.icon"} = $_[0]->getIcon; + $var{"attachment.url"} = $_[0]->getURL; + $var{"attachment.name"} = $_[0]->getFilename; + $var{"attachment.size"} = $_[0]->getSize; + $var{"attachment.type"} = $_[0]->getType; + return WebGUI::Template::process(1,"AttachmentBox",\%var); } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Macro/Snippet.pm b/lib/WebGUI/Macro/Snippet.pm index 8ecd6e57e..0f6eea67e 100644 --- a/lib/WebGUI/Macro/Snippet.pm +++ b/lib/WebGUI/Macro/Snippet.pm @@ -18,10 +18,13 @@ use WebGUI::Session; #------------------------------------------------------------------- sub process { - my (@param, $temp); - @param = WebGUI::Macro::getParams($_[0]); + my @param = WebGUI::Macro::getParams($_[0]); if (my $collateral = WebGUI::Collateral->find($param[0])) { - return $collateral->get("parameters"); + my $temp = $collateral->get("parameters"); + for my $i ( 1 .. $#param ) { + $temp =~ s/\^$i\;/$param[$i]/g; + } + return $temp; } else { return undef; } diff --git a/lib/WebGUI/i18n/English/WebGUI.pm b/lib/WebGUI/i18n/English/WebGUI.pm index 29810f94c..c82139694 100644 --- a/lib/WebGUI/i18n/English/WebGUI.pm +++ b/lib/WebGUI/i18n/English/WebGUI.pm @@ -4637,7 +4637,7 @@ A comment.

^a; or ^a(); - My Account Link
-A link to your account information. In addition you can change the link text by creating a macro like this ^a("Account Info");. +A link to your account information. In addition you can change the link text by creating a macro like this ^a("Account Info");. If you specify "linkonly" in the first parameter then only the URL will be returned. Also, you can specify the name of a template in the Macro/a_account namespace as the second parameter to override the default template.

NOTES: You can also use the special case ^a(linkonly); to return only the URL to the account page and nothing more. Also, the .myAccountLink style sheet class is tied to this macro. @@ -4649,7 +4649,7 @@ Displays a small text message to a user who is in admin mode. Example: ^Admi

^AdminToggle; or ^AdminToggle();
-Places a link on the page which is only visible to content managers and adminstrators. The link toggles on/off admin mode. You can optionally specify other messages to display like this: ^AdminToggle("Edit On","Edit Off"); +Places a link on the page which is only visible to content managers and adminstrators. The link toggles on/off admin mode. You can optionally specify other messages to display like this: ^AdminToggle("Edit On","Edit Off"); This macro optionally takes a third parameter that allows you to specify an alternate template name in the Macro/AdminToggle namespace.

^CanEditText();
@@ -4659,18 +4659,18 @@ Display a message to a user that can edit the current page.

^EditableToggle; or ^EditableToggle();
-Exactly the same as AdminToggle, except that the toggle is only displayed if the user has the rights to edit the current page. +Exactly the same as AdminToggle, except that the toggle is only displayed if the user has the rights to edit the current page. This macro takes up to three parameters. The first is a labe for "Turn Admin On", the second is a label for "Turn Admin Off", and the third is the name of a template in the Macro/EditableToggle namespace to replace the default template.

^GroupAdd();
-Using this macro you can allow users to add themselves to a group. The first parameter is the name of the group this user should be added to. The second parameter is a text string for the user to click on to add themselves to this group. +Using this macro you can allow users to add themselves to a group. The first parameter is the name of the group this user should be added to. The second parameter is a text string for the user to click on to add themselves to this group. The third parameter allows you to specify the name of a template in the Macro/GroupAdd namespace to replace the default template.

NOTE: If the user is not logged in, or or already belongs to the group, or the group is not set to allow auto adds, then no link will be displayed.

^GroupDelete();
-Using this macro you can allow users to delete themselves from a group. The first parameter is the name of the group this user should be deleted from. The second parameter is a text string for the user to click on to delete themselves from this group. +Using this macro you can allow users to delete themselves from a group. The first parameter is the name of the group this user should be deleted from. The second parameter is a text string for the user to click on to delete themselves from this group. The third parameter allows you to specify the name of a template in the Macro/GroupDelete namespace to replace the default template.

NOTE: If the user is not logged in or the user does not belong to the group, or the group is not set to allow auto deletes, then no link will be displayed.

@@ -4702,7 +4702,7 @@ The user id of the currently logged in user.

|, - lastUpdated => 1053779917 + lastUpdated => 1089730066 }, '841' => { @@ -5776,7 +5776,7 @@ Using parameters
^Snippet();
-This macro retrieves the contents of a snippet in the collateral management system and inserts it into the page. +This macro retrieves the contents of a snippet in the collateral management system and inserts it into the page. You can optionally specify up to 9 additional parameters that will be replace these special characters in the snippet: ^1; ^2; ^3; ^4; ^5; ^6; ^7; ^8; ^9;

Example: ^Snippet("flash code");

@@ -5794,7 +5794,7 @@ This macro builds a quick image viewer using nothing more than the collateral ma

|, - lastUpdated => 1051221379 + lastUpdated => 1089730066 }, '930' => { @@ -6956,7 +6956,7 @@ The description of this forum as passed by the calling object. '842' => { message => q|

These macros are used to create navigation on the site.

^H; or ^H(); - Home Link
A link to the home page of this site. In addition you can change the link text by creating a macro like this ^H("Go Home");. -

NOTES: You can also use the special case ^H(linkonly); to return only the URL to the home page and nothing more. Also, the .homeLink style sheet class is tied to this macro.

+

NOTES: You can also use the special case ^H(linkonly); to return only the URL to the home page and nothing more. Also, the .homeLink style sheet class is tied to this macro. And you can specify a second parameter that with the name of a template in the Macro/H_homeLink namespace that will override the default template.

^/; - System URL
The URL to the gateway script (example: /index.pl/).

^\; - Page URL
The URL to the current page (example: /index.pl/pagename).

^Navigation(crumbTrail);
A dynamically generated crumb trail to the current page. @@ -6985,7 +6985,7 @@ The description of this forum as passed by the calling object.

.selectedMenuItem
Use this class to highlight the current page in any of the menu macros.

.verticalMenu
The vertical menu (if you use a vertical menu macro).

.horizontalMenu
The horizontal menu (if you use a horizontal menu macro).

|, - lastUpdated => 1078477366 + lastUpdated => 1089730066 }, '1073' => {