Initial commit.
This commit is contained in:
93
lib/perl5/Selima/Form/ScptPriv.pm
Normal file
93
lib/perl5/Selima/Form/ScptPriv.pm
Normal file
@@ -0,0 +1,93 @@
|
||||
# Selima Website Content Management System
|
||||
# ScptPriv.pm: The script privilege form.
|
||||
|
||||
# Copyright (c) 2004-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: 2004-10-14
|
||||
|
||||
package Selima::Form::ScptPriv;
|
||||
use 5.008;
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(Selima::Form);
|
||||
|
||||
use Selima::FormFunc;
|
||||
use Selima::HTTP;
|
||||
use Selima::MarkAbbr;
|
||||
use Selima::ShortCut;
|
||||
use Selima::UserName;
|
||||
|
||||
# new: Initialize the HTML form table displayer
|
||||
sub new : method {
|
||||
local ($_, %_);
|
||||
my ($class, $status, $args, $self);
|
||||
($class, $status, $args) = @_;
|
||||
$args = {} if !defined $args;
|
||||
|
||||
# $args must be a hash reference
|
||||
http_500 "type of argument 2 must be a hash reference"
|
||||
if ref($args) ne "HASH";
|
||||
$$args{"type"} = form_type
|
||||
if !exists $$args{"type"};
|
||||
$$args{"table"} = "scptpriv"
|
||||
if !exists $$args{"table"};
|
||||
$$args{"deltext"} = C_("Delete this script privilege record")
|
||||
if !exists $$args{"deltext"};
|
||||
if (!exists $$args{"summary"}) {
|
||||
# A form to create a new item
|
||||
if ($$args{"type"} eq "new") {
|
||||
$$args{"summary"} = C_("This table provides you a form to add a new script privilege record.");
|
||||
# A form to edit a current item
|
||||
} elsif ($$args{"type"} eq "cur") {
|
||||
$$args{"summary"} = C_("This table provides you a form to change a current script privilege record.");
|
||||
# A form to delete a current item
|
||||
} elsif ($$args{"type"} eq "del") {
|
||||
$$args{"summary"} = C_("This table provides you a form to delete a script privilege record.");
|
||||
}
|
||||
}
|
||||
if (!exists $$args{"cols"}) {
|
||||
# A form to create a new item
|
||||
if ($$args{"type"} eq "new") {
|
||||
$$args{"cols"} = [qw(script grp)];
|
||||
# A form to edit a current item
|
||||
# A form to delete a current item
|
||||
} elsif ($$args{"type"} eq "cur" || $$args{"type"} eq "del") {
|
||||
$$args{"cols"} = [qw(sn script grp
|
||||
created createdby updated updatedby)];
|
||||
}
|
||||
}
|
||||
if (!exists $$args{"title"}) {
|
||||
# A form to create a new item
|
||||
if ($$args{"type"} eq "new") {
|
||||
$$args{"title"} = C_("Add A New Script Privilege Record");
|
||||
# A form to edit a current item
|
||||
} elsif ($$args{"type"} eq "cur") {
|
||||
$$args{"title"} = C_("Change a Current Script Privilege Record");
|
||||
# A form to delete a current item
|
||||
} elsif ($$args{"type"} eq "del") {
|
||||
$$args{"title"} = C_("Delete a Script Privilege Record");
|
||||
}
|
||||
}
|
||||
$self = $class->SUPER::new($status, $args);
|
||||
return $self;
|
||||
}
|
||||
|
||||
# _html_col_grp: The privileged group
|
||||
sub _html_col_grp : method {
|
||||
$_[0]->_html_coltmpl_call("grp", h_abbr(C_("Privilege:")), \&groupdsc);
|
||||
}
|
||||
|
||||
return 1;
|
||||
Reference in New Issue
Block a user