Schema movement

This commit is contained in:
Jamie Cameron
2007-12-13 01:47:17 +00:00
parent ef9f77d306
commit 37dd8b4ea3
4 changed files with 51 additions and 2 deletions

View File

@@ -0,0 +1,23 @@
#!/usr/local/bin/perl
# Move a schema include down (later)
require './ldap-server-lib.pl';
&local_ldap_server() == 1 || &error($text{'slapd_elocal'});
&ReadParse();
# Find it includes
&lock_file($config{'config_file'});
$conf = &get_config();
@incs = &find_value("include", $conf);
$idx = &indexof($in{'file'}, @incs);
$idx > 0 || &error($text{'schema_emove'});
# Move up
($incs[$idx+1], $incs[$idx]) = ($incs[$idx], $incs[$idx+1]);
&save_directive($conf, "include", @incs);
&flush_file_lines($config{'config_file'});
&unlock_file($config{'config_file'});
&webmin_log("sup", undef, $in{'file'});
&redirect("edit_schema.cgi");

View File

@@ -79,6 +79,7 @@ schema_eheader=Schema file contents
schema_path=Full filename
schema_edesc=This page allows you to manually edit an LDAP schema file. This should only be done if you are familiar with the file format, as no checking is done by Webmin.
schema_return=schema list
schema_emove=Could not find schema file to move!
acl_title=LDAP Access Control
@@ -187,6 +188,8 @@ log_slapd=Changed LDAP server configuration
log_schema=Changed enabled LDAP schemas
log_gencert=Generated new SSL certificate
log_sfile=Modified schema file $1
log_sup=Moved up schema file $1
log_sdown=Moved down schema file $1
gencert_title=Generate SSL Certificate
gencert_header=New SSL certificate details

View File

@@ -32,8 +32,8 @@ elsif ($type eq 'attrs') {
return &text('log_'.$action.'_attrs', $object,
"<tt>".&html_escape($p->{'dn'})."</tt>");
}
elsif ($type eq 'sfile') {
return &text('log_sfile', "<tt>".&html_escape($object)."</tt>");
elsif ($action eq 'sfile' || $action eq 'sup' || $action eq 'sdown') {
return &text('log_'.$action, "<tt>".&html_escape($object)."</tt>");
}
else {
return $text{'log_'.$action};

23
ldap-server/up_schema.cgi Normal file
View File

@@ -0,0 +1,23 @@
#!/usr/local/bin/perl
# Move a schema include up (earlier)
require './ldap-server-lib.pl';
&local_ldap_server() == 1 || &error($text{'slapd_elocal'});
&ReadParse();
# Find it includes
&lock_file($config{'config_file'});
$conf = &get_config();
@incs = &find_value("include", $conf);
$idx = &indexof($in{'file'}, @incs);
$idx > 0 || &error($text{'schema_emove'});
# Move up
($incs[$idx-1], $incs[$idx]) = ($incs[$idx], $incs[$idx-1]);
&save_directive($conf, "include", @incs);
&flush_file_lines($config{'config_file'});
&unlock_file($config{'config_file'});
&webmin_log("sup", undef, $in{'file'});
&redirect("edit_schema.cgi");