diff --git a/lib/WebGUI/AssetTrash.pm b/lib/WebGUI/AssetTrash.pm index f1aa87967..b66f008ce 100644 --- a/lib/WebGUI/AssetTrash.pm +++ b/lib/WebGUI/AssetTrash.pm @@ -16,6 +16,7 @@ package WebGUI::Asset; use strict; use WebGUI::Asset::Shortcut; +use JSON; =head1 NAME @@ -417,21 +418,37 @@ sub www_manageTrash { assetManager.AddColumn('".$i18n->get("last updated")."','','center',''); assetManager.AddColumn('".$i18n->get("size")."','','right',''); \n"; + + # To avoid string escaping issues + my $json = JSON->new; + my $amethod = sub { + my ($method, @args) = @_; + my $array = $json->encode(\@args); + $array =~ s/^\[//; + $array =~ s/\]$//; + $output .= "assetManager.$method($array);\n"; + }; foreach my $child (@{$self->getAssetsInTrash($limit)}) { - my $title = $child->getTitle; - $title =~ s/\'/\\\'/g; + my $title = $child->getTitle; my $plus =$child->getChildCount({includeTrash => 1}) ? "+ " : " "; - $output .= "assetManager.AddLine('" - .WebGUI::Form::checkbox($self->session, { - name=>'assetId', - value=>$child->getId - }) - ."','" . $plus . "getUrl("op=assetManager")."\">" . $title - ."','
getIcon(1)."\" style=\"vertical-align:middle;border-style:none;\" alt=\"".$child->getName."\" />