ispman/ispman-web/cgi-bin/tmpl/vhosts edit.tmpl,1.24,1.25 edit_aliases.tmpl,1.5,1.6 edit_header.tmpl,1.7,1.8 edit_redirects.tmpl,1.1,1.2
Joerg Delker <[email protected]>
| Newsgroups | gmane.comp.isp.ispman.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/ispman/ispman/ispman-web/cgi-bin/tmpl/vhosts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31866/ispman-web/cgi-bin/tmpl/vhosts
Modified Files:
edit.tmpl edit_aliases.tmpl edit_header.tmpl
edit_redirects.tmpl
Log Message:
some recoding of vhost forms
this change goes along with new vhostAlias method (which now should suffice all requirements)
Index: edit_aliases.tmpl
===================================================================
RCS file: /cvsroot/ispman/ispman/ispman-web/cgi-bin/tmpl/vhosts/edit_aliases.tmpl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- edit_aliases.tmpl 19 Jan 2004 23:06:10 -0000 1.5
+++ edit_aliases.tmpl 6 Jun 2004 16:22:47 -0000 1.6
@@ -1,48 +1,143 @@
-<table border>
-<tr>
-<th>Alias</th>
-</tr>
-<tr>
+<script type="text/javascript" language="JavaScript">
+<!--
+ function checkAlias(f){
+ if (f.ispmanVhostServerAlias.value == ""){
+ alert("Alias must not be empty!")
+ return false
+ } else {
+ return true
+ }
+ }
-Please note a CNAME record will be added that points to <perl>$r->param("ispmanVhostName")</perl>.<perl>$r->param("ispmanDomain")</perl><br>
-This CNAME record will be deleted when you will delete this alias. <br>
-<br>
-<tr><form>
+ function modifyAlias(f){
+ if (checkAlias(f)){
+ f.submit();
+ }
+ }
+
+ function deleteAlias(f){
+ location=cgiurl+"?mode=deleteAlias&"+cgidata+"&ispmanVhostServerAlias="+f.ispmanVhostServerAlias.value
+ }
+
+//-->
+</script>
+
+
+<!-- vhost alias add dialog -->
+<form name="alias_add" onSubmit="return checkAlias(this)">
+<table border="1">
+<tr><th colspan="2"><perl>_("Add Alias")</perl></th></tr>
+<tr>
<input type=hidden name="mode" value="addAlias">
<input type=hidden name="ispmanDomain" value="<perl>$r->param("ispmanDomain")</perl>">
<input type=hidden name="ispmanVhostName" value="<perl>$r->param("ispmanVhostName")</perl>">
-<td><input type=text name="ispmanVhostServerAlias">.<perl>$r->param("ispmanDomain")</perl></td>
-<td><input type=submit value="Add"></td>
+<td nowrap ><input type=text name="ispmanVhostServerAlias"></td>
+<td><input type=submit value="<perl>_("Add")</perl>"></td>
</tr>
+</table>
</form>
-
+<!-- vhost alias list -->
+<table>
+<tr>
<perl>
-$aliases=$ispman->getAliases($r->param("ispmanDomain"), $r->param("ispmanVhostName"));
[email protected]=();
-
-for (keys %$aliases){
-push @lines, "<tr><form>\n";
+ $domain=$r->param("ispmanDomain");
+ $aliases=$ispman->getAliases($domain,$r->param("ispmanVhostName"));
+ @lines=();
-push @lines , sprintf("<input type=hidden name=mode value=%s>", "updateAlias");
-push @lines , sprintf("<input type=hidden name=ispmanDomain value=%s>", $r->param('ispmanDomain'));
-push @lines , sprintf("<input type=hidden name=ispmanVhostName value=%s>", $r->param('ispmanVhostName'));
-push @lines , sprintf("<input type=hidden name=modifyAlias value=%s>", $aliases->{$_}{'ispmanVhostServerAlias'});
+ @aliases_local=();
+ @aliases_other=();
+
+ # get all aliases, sort them and divide by local/others
+ for ( sort { $aliases->{$a} cmp $aliases->{$b} } keys %$aliases) {
+ $alias=$aliases->{$_}{'ispmanVhostServerAlias'};
+ if ($alias =~ /\./){
+ push @aliases_other, $alias;
+ } else {
+ push @aliases_local, $alias;
+ }
+ }
-push @lines, "<td>";
-push @lines , sprintf("<input type=text name=ispmanVhostServerAlias value=%s>", $aliases->{$_}{'ispmanVhostServerAlias'});
-push @lines, "</td>";
+ if (@aliases_local){
+ push @lines, qq[
+<td valign="top">
+<table border="1">
+<tr><th colspan="2">Aliases (*.$domain)</th></tr>
+];
+ # loop through local aliases
+ $i=0;
+ foreach (@aliases_local){
+ $i++;
+ push @lines, qq[
+<tr>
+<form name="local$i" onSubmit="return checkAlias(this)">
+<input type=hidden name="mode" value="updateAlias">
+<input type=hidden name="ispmanDomain" value="$ispmanDomain">
+<input type=hidden name="ispmanVhostName" value="$ispmanVhostName">
+<input type=hidden name="modifyAlias" value="$_">
+<td nowrap>
+ <input type=text name="ispmanVhostServerAlias" value=\"$_\">
+</td>
+
+<td>
+<a href="javascript: modifyAlias(document.local$i)">
+<img src="/gfx/modify.gif" border="0"></a>
+<a href="javascript: deleteAlias(document.local$i)">
+<img src="/gfx/delete.gif" border="0"></a>
+</td>
+</form>
+</tr>
+];
+ };
+ push @lines, qq[
+</table>
+</td>
+];
+ }
-push @lines, "<td><input type=submit value=modify></td>";
-push @lines, sprintf("<td><input type=button value=delete onclick='deleteAlias(\"%s\", \"%s\", \"%s\")'></td>" , $r->param("ispmanDomain"), $r->param("ispmanVhostName"), $aliases->{$_}{'ispmanVhostServerAlias'});
-push @lines, "</tr></form>\n";
+ if (@aliases_other){
+ push @lines, qq[
+<td valign="top">
+<table border="1">
+<tr><th colspan="2">Aliases (other domains)</th></tr>
+];
+ # loop through other aliases
+ $i=0;
+ foreach (@aliases_other){
+ $i++;
+ push @lines, qq[
+<tr>
+<form name="other$i" onSubmit="return checkAlias(this)">
+<input type=hidden name="mode" value="updateAlias">
+<input type=hidden name="ispmanDomain" value="$ispmanDomain">
+<input type=hidden name="ispmanVhostName" value="$ispmanVhostName">
+<input type=hidden name="modifyAlias" value="$_">
+<td nowrap>
+ <input type=text name="ispmanVhostServerAlias" value=\"$_\">
+</td>
+
+<td>
+<a href="javascript: modifyAlias(document.other$i)">
+<img src="/gfx/modify.gif" border="0"></a>
+<a href="javascript: deleteAlias(document.other$i)">
+<img src="/gfx/delete.gif" border="0"></a>
+</td>
+</form>
+</tr>
+];
+ };
-};
+ push @lines, qq[
+</table>
+</td>
+];
+ }
-join "\n", @lines;
+ join "\n", @lines;
</perl>
+</tr>
</table>
Index: edit_redirects.tmpl
===================================================================
RCS file: /cvsroot/ispman/ispman/ispman-web/cgi-bin/tmpl/vhosts/edit_redirects.tmpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- edit_redirects.tmpl 31 May 2002 04:11:26 -0000 1.1
+++ edit_redirects.tmpl 6 Jun 2004 16:22:47 -0000 1.2
@@ -1,10 +1,40 @@
+<script type="text/javascript" language="JavaScript">
+<!--
+
+ function checkRedirection(f){
+ if (f.ispmanVhostRedirectURL.value==""){
+ alert("URL must not be empty!")
+ return false
+ }
+
+ if (f.ispmanVhostRedirectLocation.value==""){
+ alert("Location must not be empty!")
+ return false
+ }
+ return true
+ }
+
+ function modifyRedirection(f){
+ if (checkRedirection(f)){
+ f.submit()
+ }
+ }
+
+ function deleteRedirection(f){
+ location=cgiurl+"?mode=deleteRedirect&"+cgidata+"&ispmanVhostRedirectURL="+f.modifyURL.value
+ }
+
+//-->
+</script>
+
+
<table border>
<tr>
<th>URL</th><th>Location</th>
</tr>
<tr>
-<tr><form>
+<tr><form onSubmit="return checkRedirection(this)">
<input type=hidden name="mode" value="addRedirect">
<input type=hidden name="ispmanDomain" value="<perl>$r->param("ispmanDomain")</perl>">
<input type=hidden name="ispmanVhostName" value="<perl>$r->param("ispmanVhostName")</perl>">
@@ -14,35 +44,39 @@
</tr>
</form>
-
<perl>
-$redirects=$ispman->getRedirections($r->param("ispmanDomain"), $r->param("ispmanVhostName"));
[email protected]=();
-
-for (keys %$redirects){
-push @lines, "<tr><form>\n";
-
-push @lines , sprintf("<input type=hidden name=mode value=%s>", "updateRedirect");
-push @lines , sprintf("<input type=hidden name=ispmanDomain value=%s>", $r->param('ispmanDomain'));
-push @lines , sprintf("<input type=hidden name=ispmanVhostName value=%s>", $r->param('ispmanVhostName'));
-push @lines , sprintf("<input type=hidden name=modifyURL value=%s>", $redirects->{$_}{'ispmanVhostRedirectURL'});
-
-push @lines, "<td>";
-push @lines , sprintf("<input type=text name=ispmanVhostRedirectURL value=%s>", $redirects->{$_}{'ispmanVhostRedirectURL'});
-push @lines, "</td>";
+ $ispmanDomain=$r->param("ispmanDomain");
+ $ispmanVhostName=$r->param("ispmanVhostName");
+ $redirects=$ispman->getRedirections($ispmanDomain, $ispmanVhostName);
+ @lines=();
+ $i=0;
+ for (keys %$redirects){
+ $url=$redirects->{$_}{'ispmanVhostRedirectURL'};
+ $location=$redirects->{$_}{'ispmanVhostRedirectLocation'};
+ $i++;
+ push @lines, qq[
+<tr>
+<form name="redirection$i">
+<input type=hidden name="mode" value="updateRedirect">
+<input type=hidden name="ispmanDomain" value="$ispmanDomain">
+<input type=hidden name="ispmanVhostName" value="$ispmanVhostName">
+<input type=hidden name="modifyURL" value="$url">
+<td><input type=text name="ispmanVhostRedirectURL" value="$url"></td>
+<td><input type=text name="ispmanVhostRedirectLocation" value="$location"></td>
+<td>
+<a href="javascript: modifyRedirection(document.redirection$i)"><img src="/gfx/modify.gif" border="0"></a>
+<a href="javascript: deleteRedirection(document.redirection$i)"><img src="/gfx/delete.gif" border="0"></a>
+</td>
+</form>
+</tr>
+];
+ }
-push @lines, "<td>";
-push @lines , sprintf("<input type=text name=ispmanVhostRedirectLocation value=%s>", $redirects->{$_}{'ispmanVhostRedirectLocation'});
-push @lines, "</td>";
+ join "\n", @lines;
+</perl>
-push @lines, "<td><input type=submit value=modify></td>";
-push @lines, sprintf("<td><input type=button value=delete onclick='deleteRedirection(\"%s\", \"%s\", \"%s\")'></td>" , $r->param("ispmanDomain"), $r->param("ispmanVhostName"), $redirects->{$_}{'ispmanVhostRedirectURL'});
-push @lines, "</tr></form>\n";
+</table>
-};
-join "\n", @lines;
-</perl>
-</table>
Index: edit.tmpl
===================================================================
RCS file: /cvsroot/ispman/ispman/ispman-web/cgi-bin/tmpl/vhosts/edit.tmpl,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- edit.tmpl 26 May 2004 16:42:46 -0000 1.24
+++ edit.tmpl 6 Jun 2004 16:22:47 -0000 1.25
@@ -1,10 +1,61 @@
+<script type="text/javascript" language="JavaScript">
+<!--
+
+ function deleteVhost(){
+ if (confirm("Are you sure you want to permanently delete this virtualhost?"))
+ location=cgiurl+"?mode=deleteVhost&"+cgidata
+ }
+
+ function suspendVhost(){
+ location=cgiurl+"?mode=suspendVhost&"+cgidata
+ }
+
+ function unsuspendVhost(){
+ location=cgiurl+"?mode=unsuspendVhost&"+cgidata
+ }
+
+ function checkVhost(f){
+ rc = true;
+
+ if (f.homeDirectory.value==""){
+ alert('<perl>_("vhost homedirectory is empty!")</perl>');
+ rc = false;
+ }
+
+ if (f.ispmanVhostDocumentRoot.value==""){
+ alert('<perl>_("DocumentRoot is empty")</perl>');
+ rc = false;
+ }
+
+ if (f.ispmanVhostScriptDir.value==""){
+ alert('<perl>_("ScriptDirectory is empty")</perl>');
+ rc = false;
+ }
+
+ if (f.ispmanVhostLogdir.value==""){
+ alert('<perl>_("LogDirectory is empty")</perl>');
+ rc = false;
+ }
+
+ if (f.ispmanVhostStatdir.value==""){
+ alert('<perl>_("StatDirectory is empty")</perl>');
+ rc = false;
+ }
+
+ return rc;
+ }
+
+//-->
+</script>
+
+
<table>
-<form name="VhostsForm" action="<perl>$ispman->getConfig('ispmanUrlPrefix')</perl>/admin/index.cgi" method="POST">
+<form action="<perl>$r->url</perl>/admin/index.cgi" method="POST" onSubmit="return checkVhost(this);">
<tr>
- <td>Ip address </td>
+ <td>IP address </td>
<td>
- <input size=35 type=text name=ispmanVhostIpAddress value="<perl>$ispman->{'vhost'}->{"ispmanVhostIpAddress"}</perl>">
+ <input size=35 type=text name=ispmanVhostIpAddress value="<perl>$ispman->{'vhost'}->{"ispmanVhostIpAddress"}</perl>">
</td>
</tr>
@@ -12,7 +63,7 @@
<tr>
<td>Web server </td>
<td>
- <input size=35 type=hidden name=webHost value="<perl>$ispman->{'vhost'}->{"webHost"}</perl>">
+ <input size=35 type=hidden name=webHost value="<perl>$ispman->{'vhost'}->{"webHost"}</perl>">
<perl>
my $text="";
my @webhosts=$ispman->as_array($ispman->{'vhost'}{'webHost'});
@@ -28,7 +79,7 @@
<tr>
<td>File host </td>
<td>
- <input size=35 type=hidden name=fileHost value="<perl>$ispman->{'vhost'}->{"fileHost"}</perl>">
+ <input size=35 type=hidden name=fileHost value="<perl>$ispman->{'vhost'}->{"fileHost"}</perl>">
<perl>$ispman->{'vhost'}->{"fileHost"}</perl>
</td>
</tr>
@@ -44,7 +95,7 @@
<tr>
<td>DocumentRoot </td>
<td>
- <input size=35 type=hidden name=ispmanVhostDocumentRoot value="<perl>$ispman->{'vhost'}->{"ispmanVhostDocumentRoot"}</perl>">
+ <input size=35 type=hidden name=ispmanVhostDocumentRoot value="<perl>$ispman->{'vhost'}->{"ispmanVhostDocumentRoot"}</perl>">
<perl>$ispman->{'vhost'}->{"ispmanVhostDocumentRoot"}</perl>
</td>
</tr>
@@ -109,37 +160,10 @@
</td>
</tr>
-<perl>
- # FIXME
- # This code is obsolete and should be removed when migration to new ServerAliases branch is complete
-
- if ($ispman->{'vhost'}->{"ispmanVhostServerAlias"}) {
- my $text="";
- $text="
- <tr>
- <td valign=top>Server Aliases<br>(Optional)</td>
- <td colspan=2>
- <textarea cols=35 rows=3 name=ispmanVhostServerAlias>";
-
- if (ref $ispman->{'vhost'}->{"ispmanVhostServerAlias"} eq "ARRAY"){
- my @aliases=@{$ispman->{'vhost'}->{"ispmanVhostServerAlias"}};
- for (@aliases){
- $text.= "$_\n";
- }
- } else {
- $text.=$ispman->{'vhost'}->{"ispmanVhostServerAlias"};
- }
-
- $text.="</textarea></td></tr>";
-
- $text;
- }
-</perl>
-
<tr>
<td valign=top>Extra configurations<br>(Optional)</td>
<td colspan=2>
- <textarea wrap=virtual cols=65 rows=8 name=ispmanVhostExtraConf><perl>$ispman->{'vhost'}{'ispmanVhostExtraConf'}</perl></textarea>
+ <textarea wrap=off cols=60 rows=8 name=ispmanVhostExtraConf><perl>$ispman->{'vhost'}{'ispmanVhostExtraConf'}</perl></textarea>
</td>
</tr>
@@ -197,29 +221,30 @@
<tr>
<td>Password </td>
<td>
- <input size=35 type=text name=userPassword value="<perl> $ispman->{'vhost'}->{"userPassword"}</perl>">
+ <input size=35 type=text name=userPassword value="<perl> $ispman->{'vhost'}->{"userPassword"}</perl>">
</td>
</tr>
<tr>
<td>Max Storage Space (in MB) </td>
<td>
- <input size=4 type=text name=FTPQuotaMBytes value="<perl>$ispman->{'vhost'}{'FTPQuotaMBytes'}</perl>">
+ <input size=4 type=text name=FTPQuotaMBytes value="<perl>$ispman->{'vhost'}{'FTPQuotaMBytes'}</perl>">
</td>
</tr>
<tr><td align=left colspan=2>
- <input type=hidden name=ispmanVhostName value="<perl>$ispman->{'vhost'}->{'ispmanVhostName'}</perl>">
- <input type=hidden name=ispmanDomain value="<perl>$ispman->{'vhost'}->{'ispmanDomain'}</perl>">
+ <input type=hidden name=ispmanVhostName value="<perl>$r->param("ispmanVhostName")</perl>">
+ <input type=hidden name=ispmanDomain value="<perl>$r->param("ispmanDomain")</perl>">
<input type=hidden name="mode" value="updateVhost">
- <input type=hidden name="dn" value="<perl>$r->param("dn")</perl>">
- <input type=button class="button" onClick="document.forms['VhostsForm'].reset()" value="Reset">
- <input type=button class="button" onClick="Delete()" value="Delete">
- <input type=button class="button" onClick="document.forms['VhostsForm'].submit()" value="Update">
+
+ <input type=submit class="button" value="Update">
+ <input type=button class="button" onClick="this.form.reset()" value="Reset">
<input type=button class="button"
- onClick="<perl>($ispman->{'vhost'}{'ispmanStatus'} eq "suspended")?"Unsuspend()": "Suspend()"</perl>"
+ onClick="<perl>($ispman->{'vhost'}{'ispmanStatus'} eq "suspended")?"unsuspendVhost()": "suspendVhost()"</perl>"
value="<perl>($ispman->{'vhost'}{'ispmanStatus'} eq "suspended")?"Reactivate": "Suspend"</perl>"
>
+ <input type=button class="button" onClick="deleteVhost()" value="Delete">
+
</td></tr>
</form></table>
Index: edit_header.tmpl
===================================================================
RCS file: /cvsroot/ispman/ispman/ispman-web/cgi-bin/tmpl/vhosts/edit_header.tmpl,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- edit_header.tmpl 18 Apr 2004 19:17:04 -0000 1.7
+++ edit_header.tmpl 6 Jun 2004 16:22:47 -0000 1.8
@@ -1,71 +1,18 @@
<script type="text/javascript" language="JavaScript">
<!--
- function Delete(){
- if (confirm("Are you sure you want to permanently delete this virtualhost?"))
- self.location="<perl>$r->url</perl>?mode=deleteVhost&ispmanDomain=<perl>$r->param("ispmanDomain")</perl>&ispmanVhostName=<perl>$r->param("ispmanVhostName")</perl>";
- }
-
- function Suspend(){
- self.location="<perl>$r->url</perl>?mode=suspendVhost&ispmanDomain=<perl>$r->param("ispmanDomain")</perl>&ispmanVhostName=<perl>$r->param("ispmanVhostName")</perl>";
- }
- function Unsuspend(){
- self.location="<perl>$r->url</perl>?mode=unsuspendVhost&ispmanDomain=<perl>$r->param("ispmanDomain")</perl>&ispmanVhostName=<perl>$r->param("ispmanVhostName")</perl>";
- }
-
- function deleteRedirection(domain, vhost, url){
- self.location="<perl>$r->url</perl>?mode=deleteRedirect&ispmanDomain="+domain+"&ispmanVhostName="+vhost+"&ispmanVhostRedirectURL="+url;
- }
+ var ispmanDomain="<perl>$r->param("ispmanDomain")</perl>"
+ var ispmanVhostName="<perl>$r->param("ispmanVhostName")</perl>"
+ var cgiurl="<perl>$r->url</perl>"
+ var cgidata="ispmanDomain="+ispmanDomain+"&ispmanVhostName="+ispmanVhostName
- function deleteAlias(domain,vhost,alias){
- self.location="<perl>$r->url</perl>?mode=deleteAlias&ispmanDomain="+domain+"&ispmanVhostName="+vhost+"&ispmanVhostServerAlias="+alias;
- }
-
- function gotoSubSection(section){
- self.location="<perl>$r->url</perl>?mode=editVhost&ispmanDomain=<perl>$r->param("ispmanDomain")</perl>&ispmanVhostName=<perl>$r->param("ispmanVhostName")</perl>§ion="+section;
- }
-
- function check_input(){
- homedir = document.addvhost.homeDirectory.value;
- docroot = document.addvhost.ispmanVhostDocumentRoot.value;
- scriptdir = document.addvhost.ispmanVhostScriptDir.value;
- logdir = document.addvhost.ispmanVhostLogdir.value;
- statdir = document.addvhost.ispmanVhostStatdir.value;
-
- rc = true;
-
- if (homedir==""){
- alert('<perl>_("vhost homedirectory is empty!")</perl>');
- rc = false;
- }
-
- if (docroot==""){
- alert('<perl>_("DocumentRoot is empty")</perl>');
- rc = false;
- }
-
- if (scriptdir==""){
- alert('<perl>_("ScriptDirectory is empty")</perl>');
- rc = false;
- }
-
- if (logdir==""){
- alert('<perl>_("LogDirectory is empty")</perl>');
- rc = false;
- }
-
- if (statdir==""){
- alert('<perl>_("StatDirectory is empty")</perl>');
- rc = false;
- }
+ function gotoSubSection(section){
+ location=cgiurl+"?mode=editVhost&"+cgidata+"§ion="+section
+ }
- return rc;
- }
//-->
</script>
-
-
Editing vhost: <perl>join '.', ($ispman->{'vhost'}->{'ispmanVhostName'}, $ispman->{'vhost'}->{'ispmanDomain'})</perl>
(<b><perl>($ispman->{'vhost'}{'ispmanStatus'} eq "suspended")?"<font color=red>suspended</font>": "<font color=green>active</font>"</perl></b>)
@@ -73,14 +20,16 @@
<form>
<select onChange="gotoSubSection(this.options[this.selectedIndex].value)">
<perl>
- $options={
+ $options={
"" => "General Info",
"redirects" => "URL Redirections",
"acls" => "Access controls",
"aliases" => "Website Aliases",
};
+ $selected=$r->param("section") || "";
+ $text="";
for (sort keys %$options) {
- $text.= sprintf("<option value='%s' %s>%s</option>" , $_, ($r->param("section") eq $_)?" selected " :"" , $options->{$_});
+ $text.= sprintf("<option value='%s' %s>%s</option>" , $_, ($selected eq $_)?" selected " :"" , $options->{$_});
}
$text
</perl>
-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the one
installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504