version 1.252, 2004/09/08 18:57:33
|
version 1.254, 2004/09/14 10:27:22
|
Line 1994 sub remove_user_file_handler {
|
Line 1994 sub remove_user_file_handler {
|
if (-e $udir) { |
if (-e $udir) { |
my $file=$udir.'/userfiles/'.$ufile; |
my $file=$udir.'/userfiles/'.$ufile; |
if (-e $file) { |
if (-e $file) { |
|
# |
|
# If the file is a regular file unlink is fine... |
|
# However it's possible the client wants a dir. |
|
# removed, in which case rmdir is more approprate: |
|
# |
if (-f $file){ |
if (-f $file){ |
unlink($file); |
unlink($file); |
} elsif(-d $file) { |
} elsif(-d $file) { |
rmdir($file); |
rmdir($file); |
} |
} |
if (-e $file) { |
if (-e $file) { |
|
# File is still there after we deleted it ?!? |
|
|
&Failure($client, "failed\n", "$cmd:$tail"); |
&Failure($client, "failed\n", "$cmd:$tail"); |
} else { |
} else { |
&Reply($client, "ok\n", "$cmd:$tail"); |
&Reply($client, "ok\n", "$cmd:$tail"); |
Line 3124 sub put_course_id_handler {
|
Line 3131 sub put_course_id_handler {
|
my $hashref = &tie_domain_hash($udom, "nohist_courseids", &GDBM_WRCREAT()); |
my $hashref = &tie_domain_hash($udom, "nohist_courseids", &GDBM_WRCREAT()); |
if ($hashref) { |
if ($hashref) { |
foreach my $pair (@pairs) { |
foreach my $pair (@pairs) { |
my ($key,$value)=split(/=/,$pair); |
my ($key,$descr,$inst_code)=split(/=/,$pair); |
$hashref->{$key}=$value.':'.$now; |
$hashref->{$key}=$descr.':'.$inst_code.':'.$now; |
} |
} |
if (untie(%$hashref)) { |
if (untie(%$hashref)) { |
&Reply($client, "ok\n", $userinput); |
&Reply( $client, "ok\n", $userinput); |
} else { |
} else { |
&Failure( $client, "error: ".($!+0) |
&Failure($client, "error: ".($!+0) |
." untie(GDBM) Failed ". |
." untie(GDBM) Failed ". |
"while attempting courseidput\n", $userinput); |
"while attempting courseidput\n", $userinput); |
} |
} |
} else { |
} else { |
&Failure( $client, "error: ".($!+0) |
&Failure($client, "error: ".($!+0) |
." tie(GDBM) Failed ". |
." tie(GDBM) Failed ". |
"while attempting courseidput\n", $userinput); |
"while attempting courseidput\n", $userinput); |
} |
} |
|
|
|
|
return 1; |
return 1; |
} |
} |
Line 3791 sub get_institutional_code_format_handle
|
Line 3799 sub get_institutional_code_format_handle
|
0,1,0); |
0,1,0); |
|
|
# |
# |
|
# Portofolio directory list: |
|
# |
|
# Parameters: |
|
# cmd - Command request that got us called. |
|
# tail - the remainder of the command line. In this case this is a colon |
|
# separated list containing the username and domain. |
|
# used to locate their portfolio. |
|
# client - Socket openon the client. |
|
# Returns: |
|
# 1 indicating processing should continue. |
|
# |
|
sub list_portfolio { |
|
my ($cmd, $tail, $client) = @_; |
|
my ($uname, $udom) = split(/:/, $tail); |
|
my $userinput = "$cmd:$tail"; |
|
|
|
my $udir=propath($udom,$uname).'/userfiles/portfolio'; |
|
my $dirLine=''; |
|
my $dirContents=''; |
|
if (opendir(LSDIR,$udir.'/')){ |
|
while ($dirLine = readdir(LSDIR)){ |
|
$dirContents = $dirContents.$dirLine.'<br />'; |
|
} |
|
} else { |
|
$dirContents = "No directory found\n"; |
|
} |
|
&Reply( $client, $dirContents."\n", $userinput); |
|
|
|
|
|
|
|
return 1; |
|
} |
|
®ister_handler("portls", \&list_portfolio, 0,1,0); |
|
|
|
# |
# |
# |
# |
# |
# |
# |