tora - Takamichi Akiyama wrote:
> What we did:
>  1. Hided the tool bar button "Print file directly" system-widely.

for x in `grep -l PrintDefault 
/opt/starsuite8/share/config/soffice.cfg/modules/*/toolbar/standardbar.xml`
do
echo $x; perl -i.bak -pe 's{(<toolbar:toolbaritem 
xlink:href=".uno:PrintDefault")}{$1 toolbar:visible="false"}' $x
done

The script sited above will substitute the line
 <toolbar:toolbaritem xlink:href=".uno:PrintDefault" 
toolbar:helpid="helpid:5509"/>

with
 <toolbar:toolbaritem xlink:href=".uno:PrintDefault" toolbar:visible="false" 
toolbar:helpid="helpid:5509"/>

Make it sure that no user has customized their corresponding tool bar.
grep -l PrintDefault 
/export/home/*/.starsuite8/user/config/soffice.cfg/modules/*/toolbar/standardbar.xml



>  3. Removed printer related information from system-wide template
>     files.

I have created the following a Perl script tool to do that.

#!/usr/local/bin/perl
#
# remove-printer-related-entries-from-starsuite-file.pl
#
# Usage: remove-...pl starsuite_file...
#

# http://search.cpan.org/dist/Archive-Zip/
use Archive::Zip;

@Items = qw (
             PrintReversed
             PrintEmptyPages
             PrintSingleJobs
             PrintPaperFromSetup
             PrintLeftPages
             PrintTables
             PrintControls
             PrinterSetup
             PrintAnnotationMode
             PrinterName
             PrintFaxName
             PrintRightPages
             PrintProspect
             PrintGraphics
             AllowPrintJobCancel
             PrinterIndependentLayout
             PrintDrawings
             PrintBlackFonts
            );

sub work {
    my $file = shift;
    my $zip = Archive::Zip->new();
    $zip->read($file) == AZ_OK or die "$!: $file, stopped";
    my $contents = $zip->contents("settings.xml");
    my $original = $contents;
    map {
        if ($contents =~ s{<config:config-item 
config:name="$_"([^>]*?)>([^<>]*?)</config:config-item>}{}) {
            print "Entry '$_: $2' has been successfully removed.\n";
        }
        if ($contents =~ s{<config:config-item config:name="$_"([^>]*?)/>}{}) {
            print "Entry '$_' has been successfully removed.\n";
        }
    } @Items;
    if ($original ne $contents) {
        $zip->contents("settings.xml", $contents);
        $zip->overwrite() == AZ_OK or die "$!: $file, stopped";
    }
    else {
        print "No printer related entry was found. The file is not changed.\n";
    }
}

sub main {
    foreach my $file (@ARGV) {
        work($file);
    }
}

main;

__END__

Kind regards,
Tora

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to