--- /dev/null 2008-03-12 17:01:43.367208064 +0100 +++ smeserver-openoffice-portable-2.3.1/root/opt/openoffice/OpenOfficePortable/OpenOfficePortable.ini 2008-03-14 14:14:07.000000000 +0100 @@ -0,0 +1,8 @@ +[OpenOfficePortable] +OpenOfficeDirectory=App\openoffice +SettingsDirectory=Data\settings +OpenOfficeExecutable=soffice.exe +WaitForOpenOffice=false +RunDataLocally=true +DisableSplashScreen=true + --- smeserver-openoffice-portable-2.3.1/root/etc/e-smith/events/actions/openoffice-usersettings.pathesfix 2008-02-22 18:47:55.000000000 +0100 +++ smeserver-openoffice-portable-2.3.1/root/etc/e-smith/events/actions/openoffice-usersettings 2008-03-14 14:34:17.000000000 +0100 @@ -1,13 +1,18 @@ #!/usr/bin/perl -w -# Michael Weinberger, Feb 2008 + +# Michael Weinberger, (C) 2008 use strict; use esmith::AccountsDB; use esmith::ConfigDB; use File::Path; +use XML::Twig; + sub file_assoc($$); sub patch_netlogon($); sub create_profiledir($); +sub replace_value($$$$%); +sub patch_xcu_file($$$%); (my $self=$0)=~s/.*\///; my $event=$ARGV[0]||''; @@ -146,9 +151,73 @@ chmod 0700, "$settings/$username"; if( not -d "$settings/$username/user" && -d "/opt/openoffice/OpenOfficePortable/Data/settings/user" ) { + system( "/bin/rm -f /opt/openoffice/OpenOfficePortable/Data/settings/user/registry/cache/*" ); system( "/bin/cp -fR /opt/openoffice/OpenOfficePortable/Data/settings/user $settings/$username" ); system( "/bin/chown -R $username.$username $settings/$username/user" ); + + + # Firstname, Lastname, Initials + my $xcu_file = "/home/e-smith/files/ooSettings/$username/user/registry/data/org/openoffice/UserProfile.xcu"; + if( -f $xcu_file ) + { + my $givenname=$accountdb->get_prop( $username, 'FirstName')||''; + my $sn=$accountdb->get_prop( $username, 'LastName')||''; + my %UserProfile = + ( + 'Data->givenname'=>$givenname, + 'Data->sn'=>$sn, + 'Data->initials'=>substr($givenname,0,1).substr($sn,0,1) + ); + my $r=patch_xcu_file($xcu_file, $username, $ServerName, %UserProfile); + $r->XML::Twig::print_to_file("$xcu_file"); + } } + # 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"; } +sub replace_value($$$$%) +{ + my ($sn, $name, $account, $ServerName, %vals) = @_; + for my $node ($sn) + { + foreach my $child ($node->children()) + { + if( defined $vals{$name} ) + { + $child->set_atts('xsi:nil'=>'false') if( $child->att('xsi:nil')); + $child->set_atts('xsi:nil'=>'true') if( not $vals{$name} ); + $child->set_text($vals{$name}); + } + replace_value( + $child, + $name . ($child->att('oor:name') ? "->".$child->att('oor:name') : ''), + $account, + $ServerName, + %vals + ) if $child->has_children() && $child->name() ne 'value'; + } + } +} + +sub patch_xcu_file($$$%) + { + my ($xmlfile, $account, $ServerName, %vals)=@_; + my $twig= XML::Twig->new( PrettyPrint => "indented"); + $twig->parsefile($xmlfile) or die "Parse error"; + my $root = $twig->root(); + for my $node ($root->children('node')) + { + replace_value($node, $node->att('oor:name'), $account, $ServerName, %vals); + } + return $root; + } --- smeserver-openoffice-portable-2.3.1/root/etc/e-smith/templates/etc/smb.conf/50openoffice-portable.pathesfix 2008-02-14 14:56:52.000000000 +0100 +++ smeserver-openoffice-portable-2.3.1/root/etc/e-smith/templates/etc/smb.conf/50openoffice-portable 2008-03-14 14:14:07.000000000 +0100 @@ -1,3 +1,7 @@ +{ + return "" unless (($openoffice{status}||'enabled') eq "enabled"); + + $OUT .= <