From 72695f0356210b5ca68d33d09e91c00ed9d6c2b6 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Tue, 12 Feb 2013 04:55:44 -0500
Subject: [PATCH] Merged Revisions 3771-3801 from stable branch.

---
 interface/web/sites/templates/web_vhost_subdomain_edit.htm |   63 +++++++++++++++++++++++--------
 1 files changed, 47 insertions(+), 16 deletions(-)

diff --git a/interface/web/sites/templates/web_vhost_subdomain_edit.htm b/interface/web/sites/templates/web_vhost_subdomain_edit.htm
index 0c6877d..30745dd 100644
--- a/interface/web/sites/templates/web_vhost_subdomain_edit.htm
+++ b/interface/web/sites/templates/web_vhost_subdomain_edit.htm
@@ -5,17 +5,33 @@
 
     <div class="pnl_formsarea">
         <fieldset class="inlineLabels">
+            <input type="hidden" name="server_id" id="server_id" value="{tmpl_var name='server_id_value'}" />
+            <tmpl_if name="domain_option">
+            <div class="ctrlHolder">
+                <label for="parent_domain_id">{tmpl_var name='parent_domain_id_txt'}</label>
+                <select id="parent_domain_id" name="parent_domain_id" class="selectInput formLengthHalf">{tmpl_var name='parent_domain_id'}</select>
+            </div>
+            </tmpl_if>
             <div class="ctrlHolder">
                 <label for="domain">{tmpl_var name='host_txt'}</label>
                 <input name="domain" id="domain" value="{tmpl_var name='domain'}" size="30" maxlength="255" type="text" class="textInput formLengthHalf" />
             </div>
+            <tmpl_if name="domain_option">
+            <div class="ctrlHolder">
+                <label for="sel_domain">{tmpl_var name='domain_txt'}</label>
+                    <select name="sel_domain" id="sel_domain" class="selectInput">
+                        {tmpl_var name='domain_option'}
+                    </select>
+            </div>
+            <tmpl_else>
             <div class="ctrlHolder">
                 <label for="parent_domain_id">{tmpl_var name='domain_txt'}</label>
                 <select id="parent_domain_id" name="parent_domain_id" class="selectInput formLengthHalf">{tmpl_var name='parent_domain_id'}</select>
             </div>
+            </tmpl_if>
             <div class="ctrlHolder">
                 <label for="web_folder">{tmpl_var name='web_folder_txt'}</label>
-                <input name="web_folder" id="web_folder" value="{tmpl_var name='web_folder'}" size="30" maxlength="100" type="text" class="textInput formLengthHalf" />
+                <input name="web_folder" id="web_folder" value="{tmpl_var name='web_folder'}" size="30" maxlength="100" type="text" class="textInput formLengthHalf"<tmpl_if name='fixed_folder' op='==' value='y'> readonly="readonly"</tmpl_if> />
             </div>
             <div class="ctrlHolder">
                 <label for="hd_quota">{tmpl_var name='hd_quota_txt'}</label>
@@ -104,7 +120,7 @@
 
         <div class="buttonHolder buttons">
             <button id="dom-edit-submit" class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}"><span>{tmpl_var name='btn_save_txt'}</span></button>
-            <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('sites/web_vhost_subdomain_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
+            <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onclick="loadContent('sites/web_vhost_subdomain_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
         </div>
     </div>
 
@@ -124,8 +140,7 @@
             reloadFastcgiPHPVersions();
         });
     }
-    adjustForm();
-    reloadFastcgiPHPVersions();
+    reloadServerId(true);
 		
     jQuery('#client_group_id').change(function(){
         clientGroupId = $(this).val();
@@ -145,25 +160,44 @@
             jQuery('.fastcgi_php_version:visible').hide();
         }
     });
-		
-    function adjustForm(){
+    jQuery('#parent_domain_id').change(function() {
+        reloadServerId(false);
+    });
+    
+    function reloadServerId(noFormChange) {
+        var parentWebId = jQuery('#parent_domain_id').val();
+        jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {web_id : parentWebId, type : "getserverid"}, function(data) {
+            if(data.serverid) serverId = data.serverid;
+            adjustForm(noFormChange);
+            if(noFormChange) reloadFastcgiPHPVersions(noFormChange);
+        });
+    }
+    
+    function adjustForm(noFormChange){
         jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, type : "getservertype"}, function(data) {
             if(data.servertype == "nginx"){
                 var selected = jQuery('#php').val();
                 jQuery('.apache').hide();
-                jQuery('.apache').hide();
+                if(selected != "no" && selected != "php-fpm") {
+                    jQuery('#php option[value="php-fpm"]').attr('selected', 'selected').val('php-fpm');
+                }
                 jQuery('#php option[value="fast-cgi"]').hide();
                 jQuery('#php option[value="cgi"]').hide();
                 jQuery('#php option[value="mod"]').hide();
                 jQuery('#php option[value="suphp"]').hide();
-                if(selected != "no" && selected != "php-fpm") jQuery('#php option[value="php-fpm"]').attr('selected', 'selected');
             } else {
-                jQuery('.apache').show();
                 jQuery('.apache').show();
                 jQuery('#php option[value="fast-cgi"]').show();
                 jQuery('#php option[value="cgi"]').show();
                 jQuery('#php option[value="mod"]').show();
                 jQuery('#php option[value="suphp"]').show();
+            }
+            if(noFormChange) {
+                resetFormChanged();
+                jQuery('#php').addClass('no-page-form-change').change();
+                jQuery('#php').removeClass('no-page-form-change');
+            } else {
+                jQuery('#php').change();
             }
         });
     }
@@ -173,7 +207,7 @@
         loadOptionInto('ipv6_address','sites/ajax_get_ip.php?ip_type=IPv6&server_id='+serverId+'&client_group_id='+clientGroupId);
     }
 		
-    function reloadFastcgiPHPVersions() {
+    function reloadFastcgiPHPVersions(noFormChange) {
         jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, php_type : jQuery('#php').val(), type : "getphpfastcgi"}, function(data) {
             var options = '<option value="">Default</option>';
             var phpfastcgiselected = '';
@@ -185,17 +219,14 @@
                 }
                 options += '<option value="'+key+'"'+phpfastcgiselected+'>'+val+'</option>';
             });
-            $('#fastcgi_php_version').html(options);
+            $('#fastcgi_php_version').html(options).change();
+            if(noFormChange) resetFormChanged();
         });
     }
     
     <tmpl_if name="readonly_tab">
-        jQuery('div.panel_web_domain').find('fieldset').find('input,select,button').attr('disabled', 'disabled');
-        jQuery('div.tabbox_tabs').find('a').click(function() {
-               jQuery('div.panel_web_domain').find('fieldset').find('input,select,button').removeAttr('disabled');
-        });
+        jQuery('div.panel_web_domain').find('fieldset').find('input,select,button').bind('click mousedown', function(e) { e.preventDefault(); }).focus(function() { $(this).blur(); });
         jQuery('#dom-edit-submit').click(function() {
-               jQuery('div.panel_web_domain').find('fieldset').find('input,select,button').removeAttr('disabled');
                submitForm('pageForm','sites/web_vhost_subdomain_edit.php');
         });
     <tmpl_else>

--
Gitblit v1.9.1