52 lines
1.5 KiB
Perl
52 lines
1.5 KiB
Perl
# Selima Website Content Management System
|
|
# Rebuild.pm: The web page rebuild form checker.
|
|
|
|
# Copyright (c) 2006-2018 imacat.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# Author: imacat <imacat@mail.imacat.idv.tw>
|
|
# First written: 2006-04-04
|
|
|
|
package Selima::Checker::Rebuild;
|
|
use 5.008;
|
|
use strict;
|
|
use warnings;
|
|
use base qw(Selima::Checker);
|
|
|
|
use Selima::DataVars qw(:scptconf);
|
|
use Selima::ShortCut;
|
|
|
|
# _check_type: Check the page type
|
|
sub _check_type : method {
|
|
local ($_, %_);
|
|
my ($self, $form, $error);
|
|
$self = $_[0];
|
|
$form = $self->{"form"};
|
|
# Check if it exists
|
|
$error = $self->_missing("type");
|
|
return $error if defined $error;
|
|
# Regularize it
|
|
$self->_trim("addr");
|
|
# Check if it is filled
|
|
return {"msg"=>N_("Please select the type.")}
|
|
if $form->param("type") eq "";
|
|
# Check if this link exists
|
|
return {"msg"=>N_("This type does not exist anymore. Please select another one.")}
|
|
unless defined $MAIN->can("rebuild_" . $form->param("type"));
|
|
# OK
|
|
return;
|
|
}
|
|
|
|
return 1;
|