--- smeserver-subversion-1.2/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/subversion.pm.validateDescriptionAllowAccents 2007-12-25 14:57:22.000000000 +0100 +++ smeserver-subversion-1.2/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/subversion.pm 2007-12-25 15:41:29.000000000 +0100 @@ -41,7 +41,6 @@ our @ISA = qw(esmith::FormMagick Exporter); -#our @EXPORT = qw(); our @EXPORT = qw( print_repository_table print_repository_name_field @@ -54,12 +53,11 @@ getExtraParams print_save_or_add_button validate_name + validate_description validate_radio wherenext ); -#our $VERSION = sprintf'%d.%03d', q$Revision: 30 $ =~ /: (\d+).(\d+)/; - our $configdb = esmith::ConfigDB->open or die "Can't open the Config database : $!\n" ; @@ -143,12 +141,6 @@ my $modDAVSVNStatus = 0 ; $modDAVSVNStatus = 1 if ( ( $modDAVSVN->prop('status') || 'disabled' ) eq 'enabled' ) ; -# my $modAuthzSVN = $configdb->get('modAuthzSVN') -# or ($self->error('ERR_NO_MODAUTHZSVN_RECORD') and return undef) ; - -# my $modAuthzSVNStatus = 0 ; -# $modAuthzSVNStatus = 1 if ( ( $modAuthzSVN->prop('status') || 'disabled' ) eq 'enabled' ) ; - my $SysConfig = $configdb->get('sysconfig') ; my $SMEVersion = ( $SysConfig->prop('ReleaseVersion') || 0 ) ; $SMEVersion =~ s/^(\d+)\..*$/$1/ ; @@ -191,18 +183,6 @@ . "", "sme-noborders-content" ),"\n", ),"\n"; -# print $q->Tr( -# esmith::cgi::genCell( $q, -# "\""localise('STATUS_MODAUTHZSVN_' . $modAuthzSVNStatus) . "\">" ), -# esmith::cgi::genCell( $q, -# $self->localise('SERVICE_MODAUTHZSVN_' . $modAuthzSVNStatus) , "sme-noborders-label" ), -# esmith::cgi::genCell( $q, "" -# . $self->localise('BUTTON_LABEL_SERVICE_' . $modAuthzSVNStatus ) -# . "", "sme-noborders-content" ),"\n", -# ),"\n"; - print $q->end_table(),"\n"; return undef; @@ -520,12 +500,8 @@ -value=>join(FS, split(FS, $rec->prop('Groups')))); $q->param(-name=>'users', -value=>join(FS, split(FS, $rec->prop('Users')))); -# $q->param(-name=>'authentification_file', -# -value=>$rec->prop('AuthentificationFile')); $q->param(-name=>'authentification_required', -value=>$rec->prop('AuthentificationRequired')); -# $q->param(-name=>'authorization_required', -# -value=>$rec->prop('AuthorizationRequired')), $q->param(-name=>'access_type', -value=>$rec->prop('AccessType')), $q->param(-name=>'force_ssl', @@ -557,7 +533,6 @@ sub group_list { my @groups = $accountdb->groups(); -# my %groups = ( admin => 'Admin', shared => 'Everyone', none => ' None'); my %groups = (); foreach my $g (@groups) { $groups{$g->key()} = $g->prop('Description')." (".$g->key.")"; @@ -575,10 +550,8 @@ sub user_list { my @users = $accountdb->users(); -# my %users = ( admin => 'Admin', shared => 'Everyone' , none => ' None'); my %users = (); foreach my $u (@users) { -# $users{$u->key()} = $u->prop('FirstName')." ". $u->prop('LastName')." ".$u->prop('Description')." (". $u->key.")"; $users{$u->key()} = $u->prop('LastName').", ". $u->prop('FirstName')." (". $u->key.")"; } return \%users; @@ -613,8 +586,6 @@ return \%props; } - - =head1 THE ROUTINES THAT ACTUALLY DO THE WORK =cut @@ -712,9 +683,7 @@ Removable => 'yes', ForceSSL => $self->cgi->param('force_ssl'), AccessType => $self->cgi->param('access_type'), -# AuthorizationRequired => $self->cgi->param('authorization_required'), AuthentificationRequired => $self->cgi->param('authentification_required'), -# AuthentificationFile => $self->cgi->param('authentification_file'), type => 'repository', }) ) { @@ -794,9 +763,7 @@ Users => $u_list, ForceSSL => $self->cgi->param('force_ssl'), AccessType => $self->cgi->param('access_type'), -# AuthorizationRequired => $self->cgi->param('authorization_required'), AuthentificationRequired => $self->cgi->param('authentification_required'), -# AuthentificationFile => $self->cgi->param('authentification_file'), type => 'repository', ); @@ -929,6 +896,26 @@ } +=head2 validate_description() + +Checks that the name supplied does not contain any unacceptable chars. +Returns OK on success or a localised error message otherwise. + +=cut + +sub validate_description { + + my ($self, $description) = @_; + + unless ($description =~ /^([a-z]\X+[\_\.\-a-z0-9]*)$/) + { + return $self->localise('ACCT_NAME_HAS_INVALID_CHARS', + {acctName => $description}); + } + return "OK"; + +} + =head2 validate_radio() Checks wether a value is checked for a radio button