--- smeserver-openoffice-portable-2.3.1/root/etc/e-smith/events/actions/openoffice-usersettings.DeleteHistory 2008-03-15 17:29:26.000000000 +0100 +++ smeserver-openoffice-portable-2.3.1/root/etc/e-smith/events/actions/openoffice-usersettings 2008-03-15 17:29:26.000000000 +0100 @@ -13,6 +13,7 @@ sub create_profiledir($); sub replace_value($$$$%); sub patch_xcu_file($$$%); +sub delete_history($); (my $self=$0)=~s/.*\///; my $event=$ARGV[0]||''; @@ -60,6 +61,11 @@ my $OOP_ini ="/opt/openoffice/OpenOfficePortable/OpenOfficePortable.ini"; system("/bin/cp -a $OOP_ini.contrib $OOP_ini") if not -f $OOP_ini; } +elsif( $self eq "openoffice-delete-history" ) + { + # delete History, like recent file list + delete_history($event); + } elsif( $self eq "openoffice-assoc-oo" ) { # Add file assocations for OO native files to netlogon.bat @@ -176,15 +182,18 @@ } } # Pathes - my %OOPathes = - ( - 'Paths->Temp->WritePath'=>"", - 'Paths->Work->WritePath'=>"file://$ServerName/$username", - ); my $xcu_file = "/home/e-smith/files/ooSettings/$username/user/registry/data/org/openoffice/Office/Paths.xcu"; - my $r=patch_xcu_file($xcu_file, $username, $ServerName, %OOPathes); - $r->XML::Twig::print_to_file("$xcu_file"); - unlink "/home/e-smith/files/ooSettings/$username/user/registry/cache/org.openoffice.Office.Paths.dat"; + if( -f $xcu_file ) + { + my %OOPathes = + ( + 'Paths->Temp->WritePath'=>"", + 'Paths->Work->WritePath'=>"file://$ServerName/$username", + ); + my $r=patch_xcu_file($xcu_file, $username, $ServerName, %OOPathes); + $r->XML::Twig::print_to_file("$xcu_file"); + unlink "/home/e-smith/files/ooSettings/$username/user/registry/cache/org.openoffice.Office.Paths.dat"; + } } @@ -224,3 +233,18 @@ } return $root; } + +sub delete_history($) + { + my $username=shift; + my $Common_xcu="/home/e-smith/files/ooSettings/$username/user/registry/data/org/openoffice/Office/Common.xcu"; + return unless -f $Common_xcu; + my $twig= XML::Twig->new( PrettyPrint => "indented"); + $twig->parsefile($Common_xcu) or die "Parse error"; + my $root = $twig->root(); + for my $node ($root->children('node')) + { + $node->delete() if $node->att('oor:name') =~ /^(History|Cache|Help)$/; + } + $root->XML::Twig::print_to_file("$Common_xcu"); + }