67e4109fb9ddb8d4405f310ec05e57f140858f7b
Bernd Wurst VHost-Edit-Seite auf JQuery...

Bernd Wurst authored 10 years ago

1)  
2)   function selectedDomain() {
3)     return $('#domain option:selected').text();
4)     }
5)   
6) 
7)   function getDefaultDocroot() {
8)     var hostname;
9)     if ($('#hostname').val() == '') 
10)       hostname = selectedDomain();
11)     else
12)       hostname = $('#hostname').val() + '.' + selectedDomain();
13)     return hostname + '/htdocs';
14)   }
15)   
Bernd Wurst Sprre da Docroot-Eingabefel...

Bernd Wurst authored 9 years ago

16)   function useDefaultDocroot( default_docroot='' ) {
Bernd Wurst VHost-Edit-Seite auf JQuery...

Bernd Wurst authored 10 years ago

17)     var do_it = $('#use_default_docroot').prop('checked');
18)     var inputfield = $('#docroot');
19)     inputfield.attr('disabled', do_it);
20)     if (do_it) {
21)       $('#docroot').val(getDefaultDocroot());
22)     }
23)   }
24)   
25)   function showAppropriateLines() {
26)     type = $('input[name="vhost_type"]:checked').val();
27)     switch (type) {
28)       case "regular":
29)         $('#options_docroot').show();
30)         $('#options_scriptlang').show();
31)         $('#options_webapp').hide();
32)         break;
33)       case "dav":
34)         $('#options_docroot').show();
35)         $('#options_scriptlang').hide();
36)         $('#options_webapp').hide();
37)         break;
38)       case "svn":
39)         $('#options_docroot').hide();
40)         $('#options_scriptlang').hide();
41)         $('#options_webapp').hide();
42)         break;
43)       case "webapp":
44)         $('#options_docroot').hide();
45)         $('#options_scriptlang').hide();
46)         $('#options_webapp').show();
47)         break;
48)     }
49)   }
50) 
51) 
52)   function showhsts( event ) {
53)     var ssl = $('#ssl option:selected').val();
54)     if (ssl == 'forward') {
55)       $('#hsts_block').show();
56)     } else
57)       $('#hsts_block').hide();
58)   }
59) 
60)   function hsts_preset( event ) {
61)     var seconds = $('#hsts_preset option:selected').val();
62)     if (seconds == 'custom') {
63)       $('#hsts_seconds').show();
64)       if ($('#hsts').val() < 0) {
65)         $('#hsts').val(2592000); /* 30 Tage */
66)       }
67)     } else {
68)       $('#hsts_seconds').hide();
69)       $('#hsts').val(seconds);
70)     }
71)   }
72) 
73) 
74) $(function() {
75) 
76)   $('#hostname').change(useDefaultDocroot);
77)   $('#domain').change(useDefaultDocroot);
78)   $('#use_default_docroot').change(useDefaultDocroot);
Bernd Wurst Sprre da Docroot-Eingabefel...

Bernd Wurst authored 9 years ago

79)   useDefaultDocroot();