#!/usr/bin/perl -w
# -*- perl -*-
use P4CGI ;
use strict ;
#
#################################################################
# CONFIGURATION INFORMATION
# All config info should be in P4CGI.pm
#
#################################################################
#
# P4 depot browser, top
#
#################################################################
my $goto = &P4CGI::cgi()->param("GOTO") ;
if(defined $goto) {
&P4CGI::ONLOADSCRIPT("location='$goto';") ;
print &P4CGI::start_page("Please wait.....") ;
print &P4CGI::end_page() ;
exit 0 ;
}
&P4CGI::SKIPHEADERBUTTONS() ;
print &P4CGI::start_page("Add shortcut") ;
my $urlpath=&P4CGI::cgi()->url() ;
$urlpath =~ s|[^/]+$|| ;
my $scurl=&P4CGI::cgi()->param("SC") ;
if(!defined $scurl) {
&P4CGI::bail("Internal error! Parameter SC not defined!") ;
}
$scurl =~ s/^$urlpath// ;
my $decscurl = $scurl ;
if($decscurl =~ /\?/) {
$decscurl .= ";"
}
else {
$decscurl .= "?"
}
$scurl = &P4CGI::urlEncode($scurl) ;
my %shortcuts = &P4CGI::SHORTCUTS() ;
delete $shortcuts{&P4CGI::STARTPAGE_MARKER()} ;
my $scts = "";
my $name ;
my @sameAs ;
foreach $name (sort { uc($a) cmp uc($b) } keys %shortcuts) {
if($scts eq "") {
$scts = &P4CGI::start_table("") ;
}
my $url=$shortcuts{$name} ;
if(&P4CGI::urlEncode($url) eq $scurl) {
push @sameAs,"
$name\n" ;
}
&P4CGI::cgi()->param("RMSHORTCUT","$url\:\:\:$name") ;
my $del = &P4CGI::buttonLink(&P4CGI::cgi()->url(-query=>1),"Remove shortcut $name","Remove Shortcut") ;
&P4CGI::cgi()->delete("RMSHORTCUT") ;
$scts .= "
Name the shourtcut and press "Add Shortcut" or "Cancel" ============================================================
There already __N__ to this page:
__SCTS__
You can Go back or
continue and add another shortcut to the same page.
============================================================
var scdata='__SCURL__' + ':::' + document.TheForm.SCNAME.value ;
location='addshortcut.cgi?DP=__CURR_P4_DEPOT__;ADDSHORTCUT=' + scdata + '&GOTO=__SCURL__' ;
return false ;
============================================================
============================================================
You have the following shortcut(s) specified:
__SCTS__
If you specify an already existing name it will be modified.