#!/usr/local/bin/perl # edit_pshare.cgi # Display a form for editing or creating a new printer share require './samba-lib.pl'; &ReadParse(); $s = $in{'share'}; # check acls &error_setup("$text{'eacl_aviol'}"); if(!$s) { &error("$text{'eacl_np'} $text{'eacl_pcps'}") unless $access{'c_ps'}; } else { &error("$text{'eacl_np'} $text{'eacl_paps'}") unless &can('r', \%access, $in{'share'}); } # display if ($s) { &ui_print_header(undef, $s eq 'global' ? $text{'pshare_title1'} : $text{'pshare_title2'}, ""); &get_share($s); } else { &ui_print_header(undef, $text{'pshare_title3'}, ""); } print "
\n"; if ($s) { print "\n"; } # Vital share options.. print "\n"; print "\n"; print "
$text{'pshare_info'}
\n"; if ($s ne "global") { if ($copy = &getval("copy")) { print "\n"; } print "\n"; printf "\n"; } print "\n"; if (&foreign_check("lpadmin")) { &foreign_require("lpadmin", "lpadmin-lib.pl"); @plist = &foreign_call("lpadmin", "list_printers"); } elsif ($config{'list_printers_command'}) { @plist = split(/\s+/ , `$config{'list_printers_command'}`); } if (@plist) { local $printer = &getval("printer"); push(@plist, $printer) if ($printer && &indexof($printer, @plist) == -1); print "\n"; } else { print "\n"; } print "\n"; printf "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; printf "\n", &getval("comment"); print "\n" if ($s eq "global"); print "
", &text('share_copy',$copy),"
$text{'pshare_name'}\n", $s eq "printers" ? "" : "checked"; printf "   \n", $s eq "printers" ? "" : $s; printf " $text{'pshare_all'}\n", $s eq "printers" ? "checked" : ""; print "
$text{'pshare_unixprn'}$text{'pshare_spool'}\n", &getval("path"); print &file_chooser_button("path", 1); print "
$text{'share_available'}",&yesno_input("available"),"$text{'share_browseable'}",&yesno_input("browseable"),"
$text{'share_comment'}\n"; printf "
$text{'share_samedesc1'}

\n"; if ($s eq "global") { print "

\n"; } elsif ($s) { print "\n"; print "\n" if &can('rw', \%access, $s); print "\n"; print "\n"; print "\n"; print "\n" if &can('rv', \%access, $s); print "\n"; print "\n"; print "\n"; print "\n" if &can('rw', \%access, $s); print "

\n"; } else { print "

\n"; } if ($s) { # Icons for other share options $us = "share=".&urlize($s)."&printer=1"; local (@url, @text, @icon, $disp); if (&can('rs',\%access, $s)) { push(@url, "edit_sec.cgi?$us"); push(@text, $text{'share_security'}); push(@icon, "images/icon_2.gif"); $disp++; } if (&can('ro',\%access, $s)) { push(@url, "edit_popts.cgi?$us"); push(@text, $text{'print_option'}); push(@icon, "images/icon_3.gif"); $disp++; } if ($disp) { print &ui_hr(); print &ui_subheading($text{'share_option'}); &icons_table(\@url, \@text, \@icon); } } &ui_print_footer("", $text{'index_sharelist'});