#!/usr/bin/perl -w # -*- perl -*- use P4CGI ; use strict ; # ################################################################# # CONFIGURATION INFORMATION # All config info should be in P4CGI.pm # ################################################################# # # Set Prefereces # ################################################################# my $newp = &P4CGI::cgi()->param("SET_PREFERENCES") ; #my $fullURL = &P4CGI::cgi()->url(-full=>1) ; #if((defined $newp) and # (&P4CGI::CURRENT_CHANGE_LEVEL() >= 0)) { # &P4CGI::EXTRAHEADER(-Refresh => "1; URL=index.cgi") ; # #} ; #&P4CGI::ERRLOG("fullURL: $fullURL") ; #&P4CGI::ERRLOG("server_name: ". &P4CGI::cgi()->server_name()) ; #&P4CGI::SET_HELP_TARGET("SetPreferences") ; print "", &P4CGI::start_page("") ; my %pref_list=&P4CGI::PREF_LIST() ; my %pref=&P4CGI::PREF() ; my %pref_help = ("DP" => "Select depot to browse", "IC" => "Set to Yes for Windows users", "MX" => "Max changes to show per page. 400 for LAN 100 for WAN", "TB" => "Tab stop in source code files", "HD" => "Used in depot browser", "VC" => "File viewer can add color to some file types", "ST" => "Style preferences", "DBG" => "Used for debugging") ; print "", &P4CGI::cgi()->start_form(-method=>"GET", -action=>"SetPreferences.cgi"), &P4CGI::start_framedTable("User preferences"), &P4CGI::start_table() ; my $p ; foreach $p (sort { $ {$pref_list{$a}}[0] cmp $ {$pref_list{$b}}[0] } keys %pref_list) { my @data = @{$pref_list{$p}} ; my $type = shift @data ; $type =~ s/^\w:// ; my $desc = shift @data ; my $default = shift @data ; my $cval = $pref{$p} ; my $cell ; my $title = $pref_help{$p} ; $title = "" unless defined $title ; if($type eq "BOOL") { $cell = &P4CGI::cgi()->radio_group(-name=>$p, "values"=>[0,1], -default=> $cval, -title=>$title, -labels=>{1 => "Yes", 0 => "No"}) ; } if($type eq "LIST") { my $n = -1 ; my %alts = map { $n++ ; s/^.*;\s+// ; ($n,$_) ; } @data ; my @d = keys %alts ; $cell = &P4CGI::cgi()->popup_menu(-name=>$p, "values"=>\@d, -title=>$title, -default=>$cval, -labels=>\%alts) ; } if($type eq "INT") { $cell = &P4CGI::cgi()->textfield(-name=>$p, -size=>6, -title=>$title, -default=>$cval, -maxlength=>6) ; } ; print &P4CGI::table_row({-class=>"Prompt", -text=>"$desc:" }, { -align=>"left", -text=>$cell}) ; } print &P4CGI::table_row("",&P4CGI::cgi()->submit(-value=>'Change preferences', -name=>'SET_PREFERENCES') . " " . &P4CGI::cgi()->defaults("Reset")), &P4CGI::end_table(), &P4CGI::end_framedTable() ; print "
", &P4CGI::start_framedTable("Manage shortcuts") ; my %shortcuts = &P4CGI::SHORTCUTS() ; my $nosc = keys %shortcuts ; my $s = "s" ; $s = "" if $nosc == 1 ; $nosc = "No" if $nosc == 0 ; print "$nosc shortcut$s defined
\n" ; if($nosc ne "No") { print "\n" ; print &P4CGI::table_header("Name","Remove","Target") ; my @shortcuts = sort { uc($shortcuts{$a}) cmp uc($shortcuts{$b}) } keys %shortcuts ; while(@shortcuts) { my $target = shift @shortcuts ; my $name = $shortcuts{$target} ; my $nameNoSpace = $name ; $nameNoSpace =~ s/ / /g ; print "" ; my $t = $target ; my $del=&P4CGI::buttonCell($ENV{SCRIPT_NAME}, "Remove shortcut", "RMSHORTCUT=$t\:\:\:$name", "Remove") ; # my $mv=&P4CGI::buttonCell($ENV{SCRIPT_NAME}, # "Rename shortcut", # "RMSHORTCUT=$t\:\:\:$name", # "Rename") ; #$del = &P4CGI::buttonHMenuTable($del) ; print "$del\n" ; # print "$del $mv \n" ; } print "
$nameNoSpace$target
\n" } print &P4CGI::end_framedTable(), &P4CGI::end_page() ; # # That's all folks #