ispman/ispman-web/cgi-bin/tmpl menu.tmpl,1.47,1.48
Joerg Delker <[email protected]>
| Newsgroups | gmane.comp.isp.ispman.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/ispman/ispman/ispman-web/cgi-bin/tmpl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16000/ispman-web/cgi-bin/tmpl
Modified Files:
menu.tmpl
Log Message:
major code cleanup
* started to eliminate DN params (security)
* simplified javascript
* fixes bug [ 989665 ] ispmanDomain cant make new user
Index: menu.tmpl
===================================================================
RCS file: /cvsroot/ispman/ispman/ispman-web/cgi-bin/tmpl/menu.tmpl,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- menu.tmpl 4 May 2004 20:58:58 -0000 1.47
+++ menu.tmpl 15 Jul 2004 08:24:12 -0000 1.48
@@ -5,89 +5,73 @@
<LINK HREF="<perl>$ispman->getConfig('ispmanUrlPrefix')</perl>/ispman.css" REL="stylesheet" TYPE="text/css">
<SCRIPT LANGUAGE="JavaScript">
- function manageVhost(vhost){
- if (vhost[vhost.selectedIndex].value){
- return editVhost(vhost[vhost.selectedIndex].value) ;
- }
- }
-
- function editVhost(vhost){
- top.content.location="<perl>$ENV{'SCRIPT_NAME'}</perl>?mode=editVhost&ispmanDomain=<perl>$r->param("ispmanDomain")</perl>&ispmanVhostName="+vhost;
- }
-
+<!--
- function addVhost(){
- if(vhost=prompt("Name of virtual host (without the domain name)" , "")){
- top.content.location="<perl>$ENV{'SCRIPT_NAME'}</perl>?mode=createVhost&ispmanDomain=<perl>$r->param("ispmanDomain")</perl>&ispmanVhostName="+vhost;
- }
- }
-
- function manageUser(user){
- if (user[user.selectedIndex].value){
- dn=escape(user[user.selectedIndex].value);
- top.content.location="<perl>$ENV{'SCRIPT_NAME'}</perl>?mode=editUser&dn="+dn;
- }
- }
+ var ispmanDomain="<perl>$r->param("ispmanDomain")</perl>"
+ var cgiurl="<perl>$r->url</perl>"
+ var cgidomain="&ispmanDomain="+ispmanDomain
- function manageMailGroup(mailgroup){
- if (mailgroup[mailgroup.selectedIndex].value){
- dn=escape(mailgroup[mailgroup.selectedIndex].value);
- top.content.location="<perl>$ENV{'SCRIPT_NAME'}</perl>?mode=editMailGroup&dn="+dn;
- }
+ function selectDomain(domain){
+ location=cgiurl+"?mode=menu&ispmanDomain="+domain
}
-
- function searchUsers(dn){
- top.content.location="<perl>$ENV{'SCRIPT_NAME'}</perl>?mode=searchUsers&dn="+escape(dn);
- }
-
-
- function addUser(dn){
- top.content.location="<perl>$ENV{'SCRIPT_NAME'}</perl>?mode=createUser&dn="+escape(dn);
+ function doThis(mode,param){
+ top.content.location=cgiurl+"?mode="+mode+cgidomain+"&"+param
}
- function notifyUsers(dn){
- top.content.location="<perl>$ENV{'SCRIPT_NAME'}</perl>?mode=notifyUsers&dn="+escape(dn);
+ function editUser(user){
+ if (user){
+ doThis("editUser","uid="+user)
+ }
}
- function addMailGroup(dn){
- top.content.location="<perl>$ENV{'SCRIPT_NAME'}</perl>?mode=createMailGroup&dn="+escape(dn);
+ function searchUsers(dn){
+ top.content.location=cgiurl+"?mode=searchUsers&dn="+escape(dn);
}
- function editDomain(domain){
- top.content.location="<perl>$ENV{'SCRIPT_NAME'}</perl>?mode=editDomain&ispmanDomain="+domain;
+ function editMailGroup(dn){
+ if (dn){
+ doThis("editMailGroup","dn="+escape(dn))
+ }
}
+
function addWebUser(){
if(ispmanUserId=prompt("Name of webuser" , "")){
- if(userPassword=prompt("Password" , "")){
- top.content.location="<perl>$ENV{'SCRIPT_NAME'}</perl>?mode=addWebUser&ispmanDomain=<perl>$r->param("ispmanDomain")</perl>&ispmanUserId="+ispmanUserId+"&userPassword="+userPassword;
- }
+ if(userPassword=prompt("Password" , "")){
+ doThis("addWebUser","ispmanUserId="+ispmanUserId+"&userPassword="+userPassword)
+ }
}
}
+
function manageWebUser(user){
- if (user[user.selectedIndex].value){
- ispmanUserId=user[user.selectedIndex].value;
- top.content.location="<perl>$ENV{'SCRIPT_NAME'}</perl>?mode=editWebUser&ispmanDomain=<perl>$r->param("ispmanDomain")</perl>&ispmanUserId="+ispmanUserId;
+ if (user){
+ doThis("editWebUser","ispmanUserId="+user)
}
}
-
-</SCRIPT>
+ function editVhost(vhost){
+ if (vhost){
+ doThis("editVhost","ispmanVhostName="+vhost)
+ }
+ }
+
+ function addVhost(){
+ if(vhost=prompt("Name of virtual host (without the domain name)" , "")){
+ doThis("createVhost","ispmanVhostName="+vhost)
+ }
+ }
+
+
+//-->
+</script>
</HEAD>
-<BODY class="menu"
-topmargin="0" leftmargin="0"
-maginwidth=0 marginheight=0
->
-
+<BODY class="menu" topmargin="0" leftmargin="0" maginwidth=0 marginheight=0>
<!-- outer table -->
<table border=0 >
<td>
-
-
-
<perl>
my $text="";
@@ -96,16 +80,12 @@
my $groups;
my $thisDomainType;
-
-
$domains=$ispman->makeDomainHash($ispman->getDomains());
-
-
if ($r->param("ispmanDomain")){
$thisDomain=$r->param("ispmanDomain");
$webusers=$ispman->getWebusers($thisDomain);
- $users=$ispman->getUsers($domains->{$thisDomain});
+ $users=$ispman->getUsers($thisDomain);
$mailgroups=$ispman->getMailGroups($domains->{$thisDomain});
$thisDomainType=$ispman->getDomainType($thisDomain);
$thisDomainInfo=$ispman->getDomainInfo($thisDomain);
@@ -113,7 +93,6 @@
$r->param("ispmanDomain","");
}
-
$text.=qq|
<FORM>
@@ -123,34 +102,28 @@
<tr>
<td>
-<FONT SIZE=1 color= #330065>
-<SELECT onChange="if (this.options[this.selectedIndex].value) self.location='$ENV{'SCRIPT_NAME'}?mode=menu&ispmanDomain='+this.options[this.selectedIndex].value">|;
+<FONT SIZE=1 color="#330065">
+<SELECT onChange="selectDomain(this.options[this.selectedIndex].value)">|;
+
$text.="<OPTION>" . _("Choose domain to manage") . "</option>\n";
$text.="<OPTION>-------------------</option>\n";
-
-
-
-for $domain( keys %$domains ) {
-
- $domainInfo=$ispman->getDomainInfo($domain);
-
- if ($domainInfo->{'ispmanDomainType'} eq "replica"){
-
- $replicas->{$domainInfo->{'ispmanReplicaMaster'}}{$domain}=$domainInfo;
- } else {
- $masters->{$domain}=$domainInfo;
- };
+for $domain( keys %$domains ) {
+ $domainInfo=$ispman->getDomainInfo($domain);
+
+ if ($domainInfo->{'ispmanDomainType'} eq "replica"){
+ $replicas->{$domainInfo->{'ispmanReplicaMaster'}}{$domain}=$domainInfo;
+ } else {
+ $masters->{$domain}=$domainInfo;
+ };
}
-
-
-for my $master( sort {lc($a) cmp lc($b)} keys %$masters ) {
+for my $master( sort {lc($a) cmp lc($b)} keys %$masters ) {
$text.="<OPTION value='$master'";
if ($r->param("ispmanDomain") eq $master){
$text.= " selected ";
}
-
+
$domaintype=$masters->{$master}{'ispmanDomainType'};
$text.=">$master ( $domaintype )";
if ($masters->{$master}{'ispmanDomainLocked'} &&
@@ -159,7 +132,7 @@
}
$text.="</option>\n";
- for my $replica( keys %{$replicas->{$master}} ) {
+ for my $replica( keys %{$replicas->{$master}} ) {
$text.="<OPTION value='$replica'";
if ($r->param("ispmanDomain") eq $replica){
$text.= " selected ";
@@ -172,19 +145,15 @@
}
$text.="\n</select>";
-
-
$text.="</td></tr></form></table>\n";
-
-
if ($thisDomainType){
$text.=qq|
<table width=100% border=0>
<tr class="light"
- onclick="javascript:editDomain('$thisDomain')"
- onmouseover="javascript:style.background='white';window.status='@{[_("Edit [_1]", $thisDomain)]} ';return true;"
- onmouseout="javascript:style.background='#7490cc';window.status=''">
+ onclick="doThis('editDomain')"
+ onmouseover="this.className='lightOver'; window.status='@{[_("Edit [_1]", $thisDomain)]}'"
+ onmouseout="this.className='light'; windows.status=''">
<td><A class=menu HREF="#">Edit $thisDomain</a></td></tr>
</table>
@@ -199,33 +168,33 @@
$text.=qq|<table width=100% border=0><tr><td class=menuheader>@{[_("Manage DNS")]}</td></tr>
<tr class="light"
- onclick="javascript:parent.content.location='$ENV{'SCRIPT_NAME'}?mode=editDNSsOARecords&ispmanDomain=$thisDomain'"
- onmouseover="javascript:style.background='white';window.status='@{[_("Edit SOA Records for [_1]", $thisDomain)]}';return true;"
- onmouseout="javascript:style.background='#7490cc';window.status=''">
+ onclick="doThis('editDNSsOARecords')"
+ onmouseover="this.className='lightOver'; window.status='@{[_("Edit SOA Records for [_1]", $thisDomain)]}'"
+ onmouseout="this.className='light'; windows.status=''">
<td> <a class=menu href='#'>@{[_("SOA Records")]}</a></td></tr>
<tr class="light"
- onclick="javascript:parent.content.location='$ENV{'SCRIPT_NAME'}?mode=editDNSmXRecords&ispmanDomain=$thisDomain'"
- onmouseover="javascript:style.background='white';window.status='@{[_("Edit MX Records for [_1]", $thisDomain)]}';return true;"
- onmouseout="javascript:style.background='#7490cc';window.status=''">
+ onclick="doThis('editDNSmXRecords')"
+ onmouseover="this.className='lightOver'; window.status='@{[_("Edit MX Records for [_1]", $thisDomain)]}'"
+ onmouseout="this.className='light'; windows.status=''">
<td> <a class=menu href='#'>@{[_("MX Records")]}</a></td></tr>
<tr class="light"
- onclick="javascript:parent.content.location='$ENV{'SCRIPT_NAME'}?mode=editDNSnSRecords&ispmanDomain=$thisDomain'"
- onmouseover="javascript:style.background='white';window.status='@{[_("Edit NS Records for [_1]", $thisDomain)]}';return true;"
- onmouseout="javascript:style.background='#7490cc';window.status=''">
+ onclick="doThis('editDNSnSRecords')"
+ onmouseover="this.className='lightOver'; window.status='@{[_("Edit NS Records for [_1]", $thisDomain)]}'"
+ onmouseout="this.className='light'; windows.status=''">
<td> <a class=menu href='#'>@{[_("NS Records")]}</a></td></tr>
<tr class="light"
- onclick="javascript:parent.content.location='$ENV{'SCRIPT_NAME'}?mode=editDNSaRecords&ispmanDomain=$thisDomain'"
- onmouseover="javascript:style.background='white';window.status='@{[_("Edit A Records for [_1]", $thisDomain)]}';return true;"
- onmouseout="javascript:style.background='#7490cc';window.status=''">
+ onclick="doThis('editDNSaRecords')"
+ onmouseover="this.className='lightOver'; window.status='@{[_("Edit A Records for [_1]", $thisDomain)]}'"
+ onmouseout="this.className='light'; windows.status=''">
<td> <a class=menu href='#'>@{[_("A Records")]}</a></td></tr>
<tr class="light"
- onclick="javascript:parent.content.location='$ENV{'SCRIPT_NAME'}?mode=editDNScNAMERecords&ispmanDomain=$thisDomain'"
- onmouseover="javascript:style.background='white';window.status='@{[_("Edit CNAME Records for [_1]", $thisDomain)]}';return true;"
- onmouseout="javascript:style.background='#7490cc';window.status=''">
+ onclick="doThis('editDNScNAMERecords')"
+ onmouseover="this.className='lightOver'; window.status='@{[_("Edit CNAME Records for [_1]", $thisDomain)]}'"
+ onmouseout="this.className='light'; windows.status=''">
<td> <a class=menu href='#'>@{[_("CNAME Records")]}</a></td></tr>
</table>
@@ -237,30 +206,33 @@
$text.=qq|<table width=100% border=0><tr><form>
<td class=menuheader>@{[_("Manage users")]} </td></tr>
<tr class="light"
- onclick="javascript:void(searchUsers('$domains->{$thisDomain}'))"
- onmouseover="javascript:style.background='white';window.status='@{[_("Search for users under [_1]", $thisDomain)]}';return true;"
- onmouseout="javascript:style.background='#7490cc';window.status=''">
+ onclick="doThis('searchUsers')"
+ onmouseover="this.className='lightOver'; window.status='@{[_("Search for users under [_1]", $thisDomain)]}'"
+ onmouseout="this.className='light'; windows.status=''">
<td><a class=menu href="#">@{[_("Search users")]}</a> </td></tr>
<tr class="light"
- onclick="javascript:void(addUser('$domains->{$thisDomain}'))"
- onmouseover="javascript:style.background='white';window.status='@{[_("Add a user to [_1]", $thisDomain)]}';return true;"
- onmouseout="javascript:style.background='#7490cc';window.status=''">
+ onclick="doThis('createUser')"
+ onmouseover="this.className='lightOver'; window.status='@{[_("Add a user to [_1]", $thisDomain)]}'"
+ onmouseout="this.className='light'; windows.status=''">
<td><a class=menu href="#">@{[_("Add user")]}</a> </td></tr>
<tr>
<td>
- <SELECT NAME="users" onChange="manageUser(this.options)">
+ <SELECT NAME="users" onChange="editUser(this.options[this.selectedIndex].value)">
<OPTION VALUE="">@{[_("Select user")]}</option>
|;
- for my $user(sort{lc($a) cmp lc($b) } keys %$users) {
- $text.="<option value='$users->{$user}'> $user</option>";
+ for my $user(sort{lc($users->{$a}{'cn'}) cmp lc($users->{$b}{'cn'}) } keys %$users) {
+ my ($uid) = ($user =~ /^uid=(.*?),/);
+ $text.="<option value='$uid'}'> $users->{$user}{'cn'}</option>";
}
$text.=qq|</select></td></tr>|;
if ($ispman->getConf("messaging_service")){
- $text.=qq|<tr class="light" onclick="javascript:void(notifyUsers('$domains->{$thisDomain}'))" onmouseover="javascript:style.background='white';window.status='Send e-mail to all users of $thisDomain';return true;" onmouseout="javascript:style.background='#7490cc';window.status=''">
+ $text.=qq|<tr class="light" onclick="doThis('notifyUsers')"
+ onmouseover="this.className='lightOver'; window.status='Send e-mail to all users of $thisDomain'"
+ onmouseout="this.className='light'; windows.status=''">
<td><a class=menu href="#">Notify users</a> </td></tr>|;
}
@@ -273,15 +245,15 @@
$text.=qq|<table width=100% border=0><tr><form>
<td class=menuheader>@{[_("Manage mailgroups")]} </td></tr>
<tr class="light"
- onclick="javascript:void(addMailGroup('$domains->{$thisDomain}'))"
- onmouseover="javascript:style.background='white';window.status='@{[_("Add a mail group to [_1]", $thisDomain)]}';return true;"
- onmouseout="javascript:style.background='#7490cc';window.status=''">
+ onclick="doThis('createMailGroup')"
+ onmouseover="this.className='lightOver'; window.status='@{[_("Add a mail group to [_1]", $thisDomain)]}'"
+ onmouseout="this.className='light'; windows.status=''">
<td><a class=menu href="#">@{[_("Add mailgroup")]}</a> </td></tr>
<tr>
<td>
- <SELECT NAME="mailgroups" onChange="manageMailGroup(this.options)">
+ <SELECT NAME="mailgroups" onChange="editMailGroup(this.options[this.selectedIndex].value)">
<OPTION VALUE="">@{[_("Select mailgroup")]}</option>
|;
for my $mailgroup(sort{lc($mailgroups->{$a}{'cn'}) cmp lc($mailgroups->{$b}{'cn'}) } keys %$mailgroups) {
@@ -297,13 +269,13 @@
$text.=qq|<form><table width=100% border=0><tr><td class=menuheader>@{[_("Manage web users")]}</td></tr>
<tr class="light"
- onclick="javascript:void(addWebUser())"
- onmouseover="javascript:style.background='white';window.status='@{[_("Add a web user to [_1]", $thisDomain)]}';return true;"
- onmouseout="javascript:style.background='#7490cc';window.status=''">
+ onclick="addWebUser()"
+ onmouseover="this.className='lightOver'; window.status='@{[_("Add a web user to [_1]", $thisDomain)]}'"
+ onmouseout="this.className='light'; windows.status=''">
<td><a class=menu href="#">@{[_("Add web user")]}</a> </td></tr>
<tr><td>
- <SELECT NAME="webusers" onChange="manageWebUser(this.options)">
+ <SELECT NAME="webusers" onChange="manageWebUser(this.options[this.selectedIndex].value)">
<OPTION VALUE="">@{[_("Select web user")]}</option>
|;
for my $webuser(sort{lc($webusers->{$a}{'ispmanUserId'}) cmp lc($webusers->{$b}{'ispmanUserId'}) } keys %$webusers) {
@@ -319,14 +291,14 @@
$text.=qq|<form><table width=100% border=0><tr><td class=menuheader>@{[_("Manage virtualhosts")]}</td></tr>
<tr class="light"
- onclick="javascript:void(addVhost('$domains->{$thisDomain}'))"
- onmouseover="javascript:style.background='white';window.status='@{[_("Add a virtual host to [_1]", $thisDomain)]}';return true;"
- onmouseout="javascript:style.background='#7490cc';window.status=''">
+ onclick="addVhost()"
+ onmouseover="this.className='lightOver'; window.status='@{[_("Add a virtual host to [_1]", $thisDomain)]}'"
+ onmouseout="this.className='light';window.status=''">
<td><a class=menu href="#">@{[_("Add virtualhost")]}</a> </td></tr>
<tr>
<td>
- <SELECT NAME="vhosts" onChange="manageVhost(this.options)">
+ <SELECT NAME="vhosts" onChange="editVhost(this.options[this.selectedIndex].value)">
<option value=''>@{[_("Select virtualhost")]}</option>
|;
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click