From ac556717dbe7293759b58fa834e0b0c8a9fe58f9 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Sun, 2 Mar 2003 22:58:19 +0000 Subject: [PATCH] A couple of fixes to the one pass macro system. --- lib/WebGUI/Form.pm | 24 ++++++++++++++++++++---- lib/WebGUI/Wobject.pm | 12 ++++++++++-- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/lib/WebGUI/Form.pm b/lib/WebGUI/Form.pm index 4811c039f..2c870a671 100644 --- a/lib/WebGUI/Form.pm +++ b/lib/WebGUI/Form.pm @@ -68,6 +68,13 @@ All of the functions in this package accept the input of a hash reference contai =cut +#------------------------------------------------------------------- +sub _fixMacros { + my $value = shift; + $value =~ s/\^/\&\#94\;/g; + return $value; +} + #------------------------------------------------------------------- sub _fixQuotes { my $value = shift; @@ -82,6 +89,14 @@ sub _fixSpecialCharacters { return $value; } +#------------------------------------------------------------------- +sub _fixTags { + my $value = shift; + $value =~ s/\/\>\;/g; + return $value; +} + #------------------------------------------------------------------- =head2 checkbox ( hashRef ) @@ -1244,8 +1259,9 @@ The number of characters wide this form element should be. There should be no re sub text { my ($size, $maxLength, $value); - $value = _fixSpecialCharacters($value); - $value = _fixQuotes($_[0]->{value}); + $value = _fixSpecialCharacters($_[0]->{value}); + $value = _fixQuotes($value); + $value = _fixMacros($value); $maxLength = $_[0]->{maxlength} || 255; $size = $_[0]->{size} || $session{setting}{textBoxSize} || 30; return '{name}.'" cols="'.$columns.'" rows="'.$rows.'" wrap="'. $wrap.'" '.$_[0]->{extras}.'>'.$value.''; } diff --git a/lib/WebGUI/Wobject.pm b/lib/WebGUI/Wobject.pm index c27b6ed54..887c6dae2 100644 --- a/lib/WebGUI/Wobject.pm +++ b/lib/WebGUI/Wobject.pm @@ -1118,12 +1118,20 @@ sub www_edit { #------------------------------------------------------------------- -=head2 www_editSave ( ) +=head2 www_editSave ( hashRef ) Saves the default properties of any/all wobjects. NOTE: This method should be extended by all subclasses. +=over + +=item hashRef + +A hash reference of extra properties to set. + +=back + =cut sub www_editSave { @@ -1151,7 +1159,7 @@ sub www_editSave { editTimeout=>$session{form}{editTimeout}, moderationType=>$session{form}{moderationType}, filterPost=>$session{form}{filterPost}, - addEditStampToPosts=>$session{form}{addEditStampToPosts} + addEditStampToPosts=>$session{form}{addEditStampToPosts}, %{$_[1]} }); return "";