Diff for /loncom/publisher/loncfile.pm between versions 1.84 and 1.85

version 1.84, 2007/07/10 23:34:54 version 1.85, 2007/07/23 23:53:31
Line 226  sub empty_directory { Line 226  sub empty_directory {
   
 =over 4  =over 4
   
 =item  $user   - string [in] - Name of the user for which to check.  =item  $user     - string [in] - Name of the user for which to check.
   
 =item  $domain - string [in] - Name of the domain in which the resource  =item  $domain   - string [in] - Name of the domain in which the resource
                           might have been published.                            might have been published.
   
 =item  $file   - string [in] - Name of the file.  =item  $file     - string [in] - Name of the file.
   
   =item  $creating - string [in] - optional, type of object being created,
                                  either 'directory' or 'file'. Defaults to
                                  'file' if unspecified.
   
 =back  =back
   
Line 251  Returns: Line 255  Returns:
 =cut  =cut
   
 sub exists {  sub exists {
     my ($user, $domain, $construct) = @_;      my ($user, $domain, $construct, $creating) = @_;
       $creating ||= 'file';
   
     my $published=$construct;      my $published=$construct;
     $published=~      $published=~
  s{^/home/$user/public_html/}{/home/httpd/html/res/$domain/$user/};   s{^/home/$user/public_html/}{/home/httpd/html/res/$domain/$user/};
Line 266  sub exists { Line 272  sub exists {
     $type = 'warning';      $type = 'warning';
     $result.='<p><span class="LC_warning">'.&mt('Warning: target file exists, and has been published!').'</span></p>';      $result.='<p><span class="LC_warning">'.&mt('Warning: target file exists, and has been published!').'</span></p>';
  } else {   } else {
     $type = 'warning';      my $published_type = (-d $published) ? 'directory' : 'file';
     $result.='<p><span class="LC_warning">'.&mt('Warning: a published file of this names exists.').'</span></p>';  
       if ($published_type eq $creating) {
    $type = 'warning';
    $result.='<p><span class="LC_warning">'.&mt("Warning: a published $published_type of this name exists.").'</span></p>';
       } else {
    $type = 'error';
    $result.='<p><span class="LC_error">'.&mt("Error: a published $published_type of this name exists.").'</span></p>';
       }
  }   }
     } elsif ( -e $construct) {      } elsif ( -e $construct) {
  $type = 'warning';   $type = 'warning';
Line 680  causes the newdir operation to transitio Line 693  causes the newdir operation to transitio
 sub NewDir1 {  sub NewDir1 {
     my ($request, $username, $domain, $fn, $newfilename, $mode) = @_;      my ($request, $username, $domain, $fn, $newfilename, $mode) = @_;
   
     my ($type, $result)=&exists($username,$domain,$newfilename);      my ($type, $result)=&exists($username,$domain,$newfilename,'directory');
     $request->print($result);      $request->print($result);
     if ($result) {      if ($type eq 'error') {
  $request->print('</form>');   $request->print('</form>');
     } else {      } else {
  if ($mode eq 'testbank') {   if ($mode eq 'testbank') {

Removed from v.1.84  
changed lines
  Added in v.1.85


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>