version 1.83, 2007/04/26 21:17:16
|
version 1.87, 2007/10/18 21:58:21
|
Line 165 sub url {
|
Line 165 sub url {
|
sub display { |
sub display { |
my $fn=shift; |
my $fn=shift; |
$fn=~s-^/home/($match_username)/public_html-/priv/$1-; |
$fn=~s-^/home/($match_username)/public_html-/priv/$1-; |
return '<tt>'.$fn.'</tt>'; |
return '<span class="LC_filename">'.$fn.'</span>'; |
} |
} |
|
|
|
|
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 328 sub cleanDest {
|
Line 341 sub cleanDest {
|
$foundbad=1; |
$foundbad=1; |
$dest=~s/\.//g; |
$dest=~s/\.//g; |
} |
} |
|
$dest =~ s/(\s+$|^\s+)//g; |
if ($dest=~/[\#\?&%\":]/) { |
if ($dest=~/[\#\?&%\":]/) { |
$foundbad=1; |
$foundbad=1; |
$dest=~s/[\#\?&%\":]//g; |
$dest=~s/[\#\?&%\":]//g; |
Line 336 sub cleanDest {
|
Line 350 sub cleanDest {
|
my ($newpath)=($dest=~m|(.*)/|); |
my ($newpath)=($dest=~m|(.*)/|); |
$newpath=&relativeDest($fn,$newpath,$uname); |
$newpath=&relativeDest($fn,$newpath,$uname); |
if (! -d "$newpath") { |
if (! -d "$newpath") { |
$request->print("<p><span class=\"LC_error\">".&mt('You have requested to create file in directory [_1] which doesn\'t exist. The requested directory path has been removed from the requested file name.','"<tt>'.$newpath.'</tt>"')."</span></p>"); |
$request->print("<p><span class=\"LC_error\">".&mt('You have requested to create file in directory [_1] which doesn\'t exist. The requested directory path has been removed from the requested file name.','"'.&display($newpath).'"')."</span></p>"); |
$dest=~s|.*/||; |
$dest=~s|.*/||; |
} |
} |
} |
} |
|
if ($dest =~ /\.(\d+)\.(\w+)$/){ |
|
$request->print('<span class="LC_error">' |
|
.&mt('Bad filename [_1].<br /> <tt>(name).(number).(extension)</tt> not allowed. <br /> Removing the <tt>.number.</tt> from requested filename.',&display($dest)) |
|
.'</span>'); |
|
$dest =~ s/\.(\d+)(\.\w+)$/$2/; |
|
} |
if ($foundbad) { |
if ($foundbad) { |
$request->print("<p><span class=\"LC_error\">".&mt('Invalid characters in requested name have been removed.')."</span></p>"); |
$request->print("<p><span class=\"LC_error\">".&mt('Invalid characters in requested name have been removed.')."</span></p>"); |
} |
} |
Line 508 sub Rename1 {
|
Line 528 sub Rename1 {
|
$request->print('<input type="hidden" name="newfilename" value="'. |
$request->print('<input type="hidden" name="newfilename" value="'. |
$newfilename. |
$newfilename. |
'" /><p>'.$action.' '.&display($fn). |
'" /><p>'.$action.' '.&display($fn). |
'</tt><br />to '.&display($newfilename).'?</p>'); |
'</p><br />to '.&display($newfilename).'?</p>'); |
&CloseForm1($request, $fn); |
&CloseForm1($request, $fn); |
} else { |
} else { |
$request->print('<p>'.&mt('No new filename specified.').'</p></form>'); |
$request->print('<p>'.&mt('No new filename specified.').'</p></form>'); |
Line 674 causes the newdir operation to transitio
|
Line 694 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') { |
Line 852 sub phaseone {
|
Line 872 sub phaseone {
|
$env{'form.action'} eq 'newsequencefile' || |
$env{'form.action'} eq 'newsequencefile' || |
$env{'form.action'} eq 'newrightsfile' || |
$env{'form.action'} eq 'newrightsfile' || |
$env{'form.action'} eq 'newstyfile' || |
$env{'form.action'} eq 'newstyfile' || |
|
$env{'form.action'} eq 'newtaskfile' || |
$env{'form.action'} eq 'newlibraryfile' || |
$env{'form.action'} eq 'newlibraryfile' || |
$env{'form.action'} eq 'Select Action') { |
$env{'form.action'} eq 'Select Action') { |
my $empty=&mt('Type Name Here'); |
my $empty=&mt('Type Name Here'); |
Line 1351 function writeDone() {
|
Line 1372 function writeDone() {
|
$env{'form.action'} eq 'newsequencefile' || |
$env{'form.action'} eq 'newsequencefile' || |
$env{'form.action'} eq 'newrightsfile' || |
$env{'form.action'} eq 'newrightsfile' || |
$env{'form.action'} eq 'newstyfile' || |
$env{'form.action'} eq 'newstyfile' || |
|
$env{'form.action'} eq 'newtaskfile' || |
$env{'form.action'} eq 'newlibraryfile' || |
$env{'form.action'} eq 'newlibraryfile' || |
$env{'form.action'} eq 'Select Action' ) { |
$env{'form.action'} eq 'Select Action' ) { |
$r->print('<h3>'.&mt('New Resource').'</h3>'); |
$r->print('<h3>'.&mt('New Resource').'</h3>'); |