bernd commited on 2007-12-06 09:25:49
Zeige 4 geänderte Dateien mit 105 Einfügungen und 8 Löschungen.
git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@838 87cf0b9e-d624-0410-a070-f6ee81989793
| ... | ... |
@@ -99,6 +99,18 @@ input[type=text]:focus,input[type=password]:focus,textarea:focus {
|
| 99 | 99 |
} |
| 100 | 100 |
|
| 101 | 101 |
|
| 102 |
+div.vhostsidebyside {
|
|
| 103 |
+ max-width: 55em; |
|
| 104 |
+} |
|
| 105 |
+ |
|
| 106 |
+div.vhostoptions {
|
|
| 107 |
+ margin: 0; |
|
| 108 |
+ padding: 0; |
|
| 109 |
+ margin-left: 1em; |
|
| 110 |
+ float: right; |
|
| 111 |
+ width: 30em; |
|
| 112 |
+ /*margin-left: 2em; position: absolute; left: 45em; */ |
|
| 113 |
+} |
|
| 102 | 114 |
|
| 103 | 115 |
|
| 104 | 116 |
|
| ... | ... |
@@ -26,6 +26,7 @@ else {
|
| 26 | 26 |
} |
| 27 | 27 |
|
| 28 | 28 |
output("<script type=\"text/javascript\">
|
| 29 |
+ var default_docroot; |
|
| 29 | 30 |
|
| 30 | 31 |
function selectedDomain() {
|
| 31 | 32 |
var selected; |
| ... | ... |
@@ -39,7 +40,7 @@ output("<script type=\"text/javascript\">
|
| 39 | 40 |
hostname = selectedDomain(); |
| 40 | 41 |
else |
| 41 | 42 |
hostname = document.getElementById('hostname').value + '.' + selectedDomain();
|
| 42 |
- document.getElementById('defaultdocroot').firstChild.nodeValue = 'websites/' + hostname + '/htdocs';
|
|
| 43 |
+ default_docroot = 'websites/' + hostname + '/htdocs'; |
|
| 43 | 44 |
useDefaultDocroot(); |
| 44 | 45 |
} |
| 45 | 46 |
|
| ... | ... |
@@ -48,7 +49,7 @@ output("<script type=\"text/javascript\">
|
| 48 | 49 |
var inputfield = document.getElementById('docroot');
|
| 49 | 50 |
inputfield.disabled = do_it; |
| 50 | 51 |
if (do_it) {
|
| 51 |
- document.getElementById('docroot').value = document.getElementById('defaultdocroot').firstChild.nodeValue;
|
|
| 52 |
+ document.getElementById('docroot').value = default_docroot;
|
|
| 52 | 53 |
} |
| 53 | 54 |
} |
| 54 | 55 |
|
| ... | ... |
@@ -101,7 +102,8 @@ $form = " |
| 101 | 102 |
<div style=\"margin-left: 2em;\"><input type=\"text\" name=\"hostname\" id=\"hostname\" size=\"10\" value=\"{$vhost['hostname']}\" onchange=\"defaultDocumentRoot()\" /><strong>.</strong>".domainselect($vhost['domain_id'], 'onchange="defaultDocumentRoot()"');
|
| 102 | 103 |
$form .= "<br /><input type=\"checkbox\" name=\"options[]\" id=\"aliaswww\" value=\"aliaswww\" {$s}/> <label for=\"aliaswww\">Auch mit <strong>www</strong> davor.</label></div>
|
| 103 | 104 |
|
| 104 |
-<div id=\"options_regular\" style=\"margin-left: 2em; position: absolute; left: 45em; ".($vhost_type=='regular' ? '' : 'display: none;')."\"> |
|
| 105 |
+<div class=\"vhostsidebyside\"> |
|
| 106 |
+<div class=\"vhostoptions\" id=\"options_regular\" ".($vhost_type=='regular' ? '' : 'style="display: none;"')."> |
|
| 105 | 107 |
<h4>Optionen</h4> |
| 106 | 108 |
<h5>Speicherort für Dateien (»Document Root«)</h5> |
| 107 | 109 |
<div style=\"margin-left: 2em;\"> |
| ... | ... |
@@ -114,15 +116,17 @@ $form .= "<br /><input type=\"checkbox\" name=\"options[]\" id=\"aliaswww\" valu |
| 114 | 116 |
<option value=\"none\" ".($vhost['php'] == NULL ? 'selected="selected"' : '')." >keine Scriptsprache</option> |
| 115 | 117 |
<option value=\"mod_php\" ".($vhost['php'] == 'mod_php' ? 'selected="selected"' : '')." >PHP als Apache-Modul</option> |
| 116 | 118 |
<option value=\"fastcgi\" ".($vhost['php'] == 'fastcgi' ? 'selected="selected"' : '')." >PHP als FastCGI</option> |
| 117 |
- <option value=\"rubyonrails\" ".($vhost['php'] == 'rubyonrails' ? 'selected="selected"' : '')." >Ruby-on-Rails</option> |
|
| 119 |
+ <!-- <option value=\"rubyonrails\" ".($vhost['php'] == 'rubyonrails' ? 'selected="selected"' : '')." >Ruby-on-Rails</option> --> |
|
| 118 | 120 |
</select> |
| 119 | 121 |
</div> |
| 120 | 122 |
</div> |
| 121 | 123 |
|
| 122 |
-<div id=\"options_webapp\" style=\"margin-left: 2em; position: absolute; left: 45em; ".($vhost_type=='webapp' ? '' : 'display: none;')."\"> |
|
| 124 |
+<div class=\"vhostoptions\" id=\"options_webapp\" ".($vhost_type=='webapp' ? '' : 'style="display: none;"')."> |
|
| 123 | 125 |
<h4>Optionen</h4> |
| 124 | 126 |
<h5>Anwendung</h5> |
| 125 |
- <select name=\"webapp\" id=\"webapp\" size=\"1\"><option value=\"drupal-5\">Drupal 5.x</option></select> |
|
| 127 |
+ <select name=\"webapp\" id=\"webapp\" size=\"1\"> |
|
| 128 |
+ <option value=\"1\">Drupal 5.x</option> |
|
| 129 |
+ </select> |
|
| 126 | 130 |
</div> |
| 127 | 131 |
|
| 128 | 132 |
<h4>Verwendung</h4> |
| ... | ... |
@@ -130,8 +134,12 @@ $form .= "<br /><input type=\"checkbox\" name=\"options[]\" id=\"aliaswww\" valu |
| 130 | 134 |
<input class=\"usageoption\" onclick=\"showAppropriateLines()\" type=\"radio\" name=\"vhost_type\" id=\"vhost_type_regular\" value=\"regular\" ".(($vhost_type=='regular') ? 'checked="checked" ' : '')."/><label for=\"vhost_type_regular\"> Normal (selbst Dateien hinterlegen)</label><br /> |
| 131 | 135 |
<input class=\"usageoption\" onclick=\"showAppropriateLines()\" type=\"radio\" name=\"vhost_type\" id=\"vhost_type_dav\" value=\"dav\" ".(($vhost_type=='dav') ? 'checked="checked" ' : '')."/><label for=\"vhost_type_dav\"> WebDAV</label><br /> |
| 132 | 136 |
<input class=\"usageoption\" onclick=\"showAppropriateLines()\" type=\"radio\" name=\"vhost_type\" id=\"vhost_type_svn\" value=\"svn\" ".(($vhost_type=='svn') ? 'checked="checked" ' : '')."/><label for=\"vhost_type_svn\"> Subversion-Server</label><br /> |
| 137 |
+ <div style=\"display: none\"> |
|
| 133 | 138 |
<input class=\"usageoption\" onclick=\"showAppropriateLines()\" type=\"radio\" name=\"vhost_type\" id=\"vhost_type_webapp\" value=\"webapp\" ".(($vhost_type=='webapp') ? 'checked="checked" ' : '')."/><label for=\"vhost_type_webapp\"> Eine vorgefertigte Applikation nutzen</label> |
| 134 | 139 |
</div> |
| 140 |
+ </div> |
|
| 141 |
+<br /> |
|
| 142 |
+</div> |
|
| 135 | 143 |
|
| 136 | 144 |
<h4 style=\"margin-top: 3em;\">Allgemeine Optionen</h4> |
| 137 | 145 |
<div style=\"margin-left: 2em;\"> |
| ... | ... |
@@ -30,6 +30,9 @@ function empty_vhost() |
| 30 | 30 |
$vhost['php'] = 'mod_php'; |
| 31 | 31 |
$vhost['ssl'] = NULL; |
| 32 | 32 |
$vhost['logtype'] = NULL; |
| 33 |
+ $vhost['is_dav'] = 0; |
|
| 34 |
+ $vhost['is_svn'] = 0; |
|
| 35 |
+ $vhost['is_webapp'] = 0; |
|
| 33 | 36 |
|
| 34 | 37 |
$vhost['options'] = ''; |
| 35 | 38 |
return $vhost; |
| ... | ... |
@@ -123,6 +126,49 @@ function delete_vhost($id) |
| 123 | 126 |
} |
| 124 | 127 |
|
| 125 | 128 |
|
| 129 |
+ |
|
| 130 |
+function make_svn_vhost($id) |
|
| 131 |
+{
|
|
| 132 |
+ $id = (int) $id; |
|
| 133 |
+ if ($id == 0) |
|
| 134 |
+ system_failure("id == 0");
|
|
| 135 |
+ logger('modules/vhosts/include/vhosts.php', 'vhosts', 'Converting vhost #'.$id.' to SVN');
|
|
| 136 |
+ db_query("REPLACE INTO vhosts.dav (vhost, type) VALUES ({$id}, 'svn')");
|
|
| 137 |
+} |
|
| 138 |
+ |
|
| 139 |
+function make_dav_vhost($id) |
|
| 140 |
+{
|
|
| 141 |
+ $id = (int) $id; |
|
| 142 |
+ if ($id == 0) |
|
| 143 |
+ system_failure("id == 0");
|
|
| 144 |
+ logger('modules/vhosts/include/vhosts.php', 'vhosts', 'Converting vhost #'.$id.' to WebDAV');
|
|
| 145 |
+ db_query("REPLACE INTO vhosts.dav (vhost, type) VALUES ({$id}, 'dav')");
|
|
| 146 |
+} |
|
| 147 |
+ |
|
| 148 |
+function no_dav_or_svn($id) |
|
| 149 |
+{
|
|
| 150 |
+ $id = (int) $id; |
|
| 151 |
+ if ($id == 0) |
|
| 152 |
+ system_failure("id == 0");
|
|
| 153 |
+ logger('modules/vhosts/include/vhosts.php', 'vhosts', 'Converting vhost #'.$id.' to regular');
|
|
| 154 |
+ db_query("DELETE FROM vhosts.dav WHERE vhost={$id}");
|
|
| 155 |
+} |
|
| 156 |
+ |
|
| 157 |
+ |
|
| 158 |
+/* |
|
| 159 |
+function make_webapp_vhost($id, $webapp) |
|
| 160 |
+{
|
|
| 161 |
+ $id = (int) $id; |
|
| 162 |
+ $webapp = (int) $webapp; |
|
| 163 |
+ if ($id == 0) |
|
| 164 |
+ system_failure("id == 0");
|
|
| 165 |
+ logger('modules/vhosts/include/vhosts.php', 'vhosts', 'Setting up webapp # '.$webapp.' on vhost #'.$id);
|
|
| 166 |
+ db_query("INSERT INTO vhosts.webapps (vhost, webapp) VALUES ({$id}, {$webapp})");
|
|
| 167 |
+ |
|
| 168 |
+} |
|
| 169 |
+*/ |
|
| 170 |
+ |
|
| 171 |
+ |
|
| 126 | 172 |
function save_vhost($vhost) |
| 127 | 173 |
{
|
| 128 | 174 |
if (! is_array($vhost)) |
| ... | ... |
@@ -147,8 +193,15 @@ function save_vhost($vhost) |
| 147 | 193 |
} |
| 148 | 194 |
else {
|
| 149 | 195 |
logger('modules/vhosts/include/vhosts.php', 'vhosts', 'Creating vhost '.$vhost['hostname'].'.'.$vhost['domain'].'');
|
| 150 |
- db_query("INSERT INTO vhosts.vhost (user, hostname, domain, docroot, php, `ssl`, logtype, errorlog, options) VALUES ({$_SESSION['userinfo']['uid']}, {$hostname}, {$domain}, {$docroot}, {$php}, {$ssl}, {$logtype}, {$errorlog}, '{$options}')");
|
|
| 196 |
+ $result = db_query("INSERT INTO vhosts.vhost (user, hostname, domain, docroot, php, `ssl`, logtype, errorlog, options) VALUES ({$_SESSION['userinfo']['uid']}, {$hostname}, {$domain}, {$docroot}, {$php}, {$ssl}, {$logtype}, {$errorlog}, '{$options}')");
|
|
| 197 |
+ $id = mysql_insert_id(); |
|
| 151 | 198 |
} |
| 199 |
+ if ($vhost['is_dav'] == 1) |
|
| 200 |
+ make_dav_vhost($id); |
|
| 201 |
+ elseif ($vhost['is_svn'] == 1) |
|
| 202 |
+ make_svn_vhost($id); |
|
| 203 |
+ else |
|
| 204 |
+ no_dav_or_svn($id); |
|
| 152 | 205 |
} |
| 153 | 206 |
|
| 154 | 207 |
|
| ... | ... |
@@ -36,6 +36,13 @@ if ($_GET['action'] == 'edit') |
| 36 | 36 |
$_POST['options'] = array(); |
| 37 | 37 |
$aliaswww = in_array('aliaswww', $_POST['options']);
|
| 38 | 38 |
|
| 39 |
+ $docroot = ''; |
|
| 40 |
+ $php = ''; |
|
| 41 |
+ if ($_POST['vhost_type'] == 'regular') |
|
| 42 |
+ {
|
|
| 43 |
+ $vhost['is_dav'] = 0; |
|
| 44 |
+ $vhost['is_svn'] = 0; |
|
| 45 |
+ $vhost['is_webapp'] = 0; |
|
| 39 | 46 |
$defaultdocroot = $vhost['homedir'].'/websites/'.((strlen($hostname) > 0) ? $hostname.'.' : '').($domain->fqdn).'/htdocs'; |
| 40 | 47 |
|
| 41 | 48 |
if (! check_path( $_POST['docroot'] )) |
| ... | ... |
@@ -48,7 +55,6 @@ if ($_GET['action'] == 'edit') |
| 48 | 55 |
|
| 49 | 56 |
DEBUG("Document-Root: ".$docroot);
|
| 50 | 57 |
|
| 51 |
- $php = ''; |
|
| 52 | 58 |
switch ($_POST['php']) {
|
| 53 | 59 |
case 'mod_php': |
| 54 | 60 |
$php = 'mod_php'; |
| ... | ... |
@@ -58,6 +64,23 @@ if ($_GET['action'] == 'edit') |
| 58 | 64 |
break; |
| 59 | 65 |
/* Wenn etwas anderes kommt, ist das "kein PHP". So einfach ist das. */ |
| 60 | 66 |
} |
| 67 |
+ } |
|
| 68 |
+ elseif ($_POST['vhost_type'] == 'dav') {
|
|
| 69 |
+ $vhost['is_dav'] = 1; |
|
| 70 |
+ $vhost['is_svn'] = 0; |
|
| 71 |
+ $vhost['is_webapp'] = 0; |
|
| 72 |
+ } |
|
| 73 |
+ elseif ($_POST['vhost_type'] == 'svn') {
|
|
| 74 |
+ $vhost['is_dav'] = 0; |
|
| 75 |
+ $vhost['is_svn'] = 1; |
|
| 76 |
+ $vhost['is_webapp'] = 0; |
|
| 77 |
+ } |
|
| 78 |
+ elseif ($_POST['vhost_type'] == 'webapp') {
|
|
| 79 |
+ $vhost['is_dav'] = 0; |
|
| 80 |
+ $vhost['is_svn'] = 0; |
|
| 81 |
+ $vhost['is_webapp'] = 1; |
|
| 82 |
+ } |
|
| 83 |
+ |
|
| 61 | 84 |
|
| 62 | 85 |
$ssl = ''; |
| 63 | 86 |
switch ($_POST['ssl']) {
|
| ... | ... |
@@ -114,6 +137,7 @@ if ($_GET['action'] == 'edit') |
| 114 | 137 |
$vhost['errorlog'] = $errorlog; |
| 115 | 138 |
$vhost['options'] = $options; |
| 116 | 139 |
|
| 140 |
+ DEBUG($vhost); |
|
| 117 | 141 |
save_vhost($vhost); |
| 118 | 142 |
|
| 119 | 143 |
if (! $debugmode) |
| 120 | 144 |