From 07e1dc630a98df5824cb5c31ed798449e164dfd7 Mon Sep 17 00:00:00 2001
From: Michael Fürmann <michael@spicyweb.de>
Date: Thu, 19 Feb 2015 10:52:22 -0500
Subject: [PATCH] closes #1
---
interface/web/mail/lib/lang/en_xmpp_domain.lng | 1 +
interface/web/mail/xmpp_domain_edit.php | 7 ++++++-
interface/web/mail/templates/xmpp_domain_edit.htm | 4 ++--
interface/web/js/xmpp_domain_registration.js | 20 +++++++++++---------
4 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/interface/web/js/xmpp_domain_registration.js b/interface/web/js/xmpp_domain_registration.js
index bde0874..3794bef 100644
--- a/interface/web/js/xmpp_domain_registration.js
+++ b/interface/web/js/xmpp_domain_registration.js
@@ -1,15 +1,17 @@
$('document').ready(function(){
- $('#auth_method').on('select2-selecting', function(e){
+ $('#management_method').on('select2-selecting', function(e){
val = e.choice ? e.choice.id : e.target.selectedIndex;
- if(val == 2){
- //Mailbox
- $('#toggle-auth-internal').removeClass('in');
- $('#toggle-registration-closed').removeClass('in');
- }else if(val != undefined){
- $('#toggle-auth-internal').addClass('in');
+ if(val == 0){
+ //normal
+ $('#toggle-management-normal').addClass('in');
+ $('#toggle-registration-closed').addClass('in');
$('#public_registration').trigger('change');
+ }else if(val != undefined){
+ //maildomain
+ $('#toggle-management-normal').removeClass('in');
+ $('#toggle-registration-closed').removeClass('in');
}else{
- $('#toggle-auth-internal').removeClass('in');
+ $('#toggle-management-normal').removeClass('in');
$('#toggle-registration-closed').removeClass('in');
}
});
@@ -21,5 +23,5 @@
}
});
$('#public_registration').trigger('change');
- $('#auth_method').trigger('select2-selecting');
+ $('#management_method').trigger('select2-selecting');
})
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_xmpp_domain.lng b/interface/web/mail/lib/lang/en_xmpp_domain.lng
index 0cbf0c7..5fd20f0 100644
--- a/interface/web/mail/lib/lang/en_xmpp_domain.lng
+++ b/interface/web/mail/lib/lang/en_xmpp_domain.lng
@@ -25,5 +25,6 @@
$wb["http_archive_show_join_txt"] = 'Show join messages in archive';
$wb["http_archive_show_status_txt"] = 'Show status changes in archive';
$wb["use_status_host_txt"] = 'Enable XML Status host';
+$wb["cant_change_domainname_txt"] = 'The Domain name of existing XMPP domain cannot be changed.';
$wb["no_corresponding_maildomain_txt"] = 'Corresponding mail domain for user management not found. Please create the mail domain first.';
?>
diff --git a/interface/web/mail/templates/xmpp_domain_edit.htm b/interface/web/mail/templates/xmpp_domain_edit.htm
index 0bae7e4..5877e7b 100644
--- a/interface/web/mail/templates/xmpp_domain_edit.htm
+++ b/interface/web/mail/templates/xmpp_domain_edit.htm
@@ -67,7 +67,7 @@
{tmpl_var name='domain_option'}
</select></div>
<tmpl_else>
- <div class="col-sm-9"><input type="text" name="domain" id="domain" value="{tmpl_var name='domain'}" class="form-control" /></div></tmpl_if>
+ <div class="col-sm-9"><input type="text" name="domain" id="domain" value="{tmpl_var name='domain'}" class="form-control" <tmpl_if name="edit_disabled">readonly="readonly"</tmpl_if>/></div></tmpl_if>
</div>
@@ -81,7 +81,7 @@
</select></div>
</div>
-<div id="toggle-auth-internal" class="collapse">
+<div id="toggle-management-normal" class="collapse">
<div class="form-group">
<label class="col-sm-3 control-label">{tmpl_var name='public_registration_txt'}</label>
<div class="col-sm-9">
diff --git a/interface/web/mail/xmpp_domain_edit.php b/interface/web/mail/xmpp_domain_edit.php
index 127acd7..c13f786 100644
--- a/interface/web/mail/xmpp_domain_edit.php
+++ b/interface/web/mail/xmpp_domain_edit.php
@@ -262,7 +262,7 @@
//* make sure that the xmpp domain is lowercase
if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
- // Read auth method
+ // Read management method
if(isset($this->dataRecord["management_method"]))
switch($this->dataRecord["management_method"]){
case 0:
@@ -328,6 +328,11 @@
global $app, $conf;
if($this->_xmpp_type == 'server') {
+ // Check if the domain has been changed
+ $rec = $app->db->queryOneRecord("SELECT domain from xmpp_domain WHERE domain_id = ".$this->id);
+ if($this->dataRecord['domain']!=$rec['domain'])
+ $app->error($app->tform->wordbook["cant_change_domainname_txt"]);
+
//* Check if the server has been changed
// We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
--
Gitblit v1.9.1