Docroot auch bei WebDAV anzeigen
bernd

bernd commited on 2007-12-10 08:46:08
Zeige 3 geänderte Dateien mit 27 Einfügungen und 12 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@852 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -55,16 +55,23 @@ output("<script type=\"text/javascript\">
55 55
   
56 56
   function showAppropriateLines() {
57 57
     if (document.getElementById('vhost_type_regular').checked == true) {
58
-      document.getElementById('options_regular').style.display = 'block';
58
+      document.getElementById('options_docroot').style.display = 'block';
59
+      document.getElementById('options_scriptlang').style.display = 'block';
59 60
       document.getElementById('options_webapp').style.display = 'none';
60 61
     }
61
-    else if ((document.getElementById('vhost_type_dav').checked == true) || 
62
-         (document.getElementById('vhost_type_svn').checked == true)) {
63
-      document.getElementById('options_regular').style.display = 'none';
62
+    else if (document.getElementById('vhost_type_dav').checked == true) { 
63
+      document.getElementById('options_docroot').style.display = 'block';
64
+      document.getElementById('options_scriptlang').style.display = 'none';
65
+      document.getElementById('options_webapp').style.display = 'none';
66
+    }
67
+    else if (document.getElementById('vhost_type_svn').checked == true) {
68
+      document.getElementById('options_docroot').style.display = 'none';
69
+      document.getElementById('options_scriptlang').style.display = 'none';
64 70
       document.getElementById('options_webapp').style.display = 'none';
65 71
     }
66 72
     else if (document.getElementById('vhost_type_webapp').checked == true) {
67
-      document.getElementById('options_regular').style.display = 'none';
73
+      document.getElementById('options_docroot').style.display = 'none';
74
+      document.getElementById('options_scriptlang').style.display = 'none';
68 75
       document.getElementById('options_webapp').style.display = 'block';
69 76
     }
70 77
   }
... ...
@@ -109,13 +116,16 @@ $form = "
109 116
 $form .= "<br /><input type=\"checkbox\" name=\"options[]\" id=\"aliaswww\" value=\"aliaswww\" {$s}/> <label for=\"aliaswww\">Auch mit <strong>www</strong> davor.</label></div>
110 117
 
111 118
 <div class=\"vhostsidebyside\">
112
-<div class=\"vhostoptions\" id=\"options_regular\" ".($vhost_type=='regular' ? '' : 'style="display: none;"').">
119
+<div class=\"vhostoptions\" id=\"options_docroot\" ".($vhost_type=='regular' || $vhost_type=='dav' ? '' : 'style="display: none;"').">
113 120
   <h4>Optionen</h4>
114 121
   <h5>Speicherort für Dateien (»Document Root«)</h5>
115 122
   <div style=\"margin-left: 2em;\">
116 123
     <input type=\"checkbox\" id=\"use_default_docroot\" name=\"use_default_docroot\" value=\"1\" onclick=\"useDefaultDocroot()\" ".($is_default_docroot ? 'checked="checked" ' : '')."/>&#160;<label for=\"use_default_docroot\">Standardeinstellung benutzen</label><br />
117 124
     <strong>".$vhost['homedir']."/</strong>&#160;<input type=\"text\" id=\"docroot\" name=\"docroot\" size=\"30\" value=\"".$docroot."\" ".($is_default_docroot ? 'disabled="disabled" ' : '')."/>
118 125
   </div>
126
+</div>
127
+
128
+<div class=\"vhostoptions\" id=\"options_scriptlang\" ".($vhost_type=='regular' ? '' : 'style="display: none;"').">
119 129
   <h5>Script-Sprache</h5>
120 130
   <div style=\"margin-left: 2em;\">
121 131
     <select name=\"php\" id=\"php\">
... ...
@@ -154,7 +154,7 @@ function make_dav_vhost($id)
154 154
   if ($id == 0)
155 155
     system_failure("id == 0");
156 156
   logger('modules/vhosts/include/vhosts.php', 'vhosts', 'Converting vhost #'.$id.' to WebDAV');
157
-  db_query("REPLACE INTO vhosts.dav (vhost, type) VALUES ({$id}, 'dav')");
157
+  db_query("REPLACE INTO vhosts.dav (vhost, type, options) VALUES ({$id}, 'dav', 'nouserfile')");
158 158
   db_query("DELETE FROM vhosts.webapps WHERE vhost={$id}");
159 159
 }
160 160
 
... ...
@@ -38,11 +38,8 @@ if ($_GET['action'] == 'edit')
38 38
 
39 39
   $docroot = '';
40 40
   $php = '';
41
-  if ($_POST['vhost_type'] == 'regular')
41
+  if ($_POST['vhost_type'] == 'regular' || $_POST['vhost_type'] == 'dav')
42 42
   {
43
-    $vhost['is_dav'] = 0;
44
-    $vhost['is_svn'] = 0;
45
-    $vhost['is_webapp'] = 0;
46 43
     $defaultdocroot = $vhost['homedir'].'/websites/'.((strlen($hostname) > 0) ? $hostname.'.' : '').($domain->fqdn).'/htdocs';
47 44
   
48 45
     if (! check_path( $_POST['docroot'] ))
... ...
@@ -54,7 +51,10 @@ if ($_GET['action'] == 'edit')
54 51
     }
55 52
   
56 53
     DEBUG("Document-Root: ".$docroot);
57
-  
54
+  }
55
+  $php = '';
56
+  if ($_POST['vhost_type'] == 'regular')
57
+  {
58 58
     switch ($_POST['php']) {
59 59
       case 'mod_php':
60 60
         $php = 'mod_php';
... ...
@@ -65,6 +65,11 @@ if ($_GET['action'] == 'edit')
65 65
       /* Wenn etwas anderes kommt, ist das "kein PHP". So einfach ist das. */
66 66
     }
67 67
   }
68
+  if ($_POST['vhost_type'] == 'regular') {
69
+    $vhost['is_dav'] = 0;
70
+    $vhost['is_svn'] = 0;
71
+    $vhost['is_webapp'] = 0;
72
+  }
68 73
   elseif ($_POST['vhost_type'] == 'dav') {
69 74
     $vhost['is_dav'] = 1;
70 75
     $vhost['is_svn'] = 0;
71 76