ispman/ispman-web/cgi-bin/tmpl/vhosts edit_acls.tmpl,1.3,1.4

[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:/tmp/cvs-serv15132

Modified Files:
	edit_acls.tmpl 
Log Message:
adapted to be used by the admin panel.
Add, Delete, Modify functions are working without any clientside checks.


Index: edit_acls.tmpl
===================================================================
RCS file: /cvsroot/ispman/ispman/ispman-web/cgi-bin/tmpl/vhosts/edit_acls.tmpl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- edit_acls.tmpl	13 Jan 2004 14:35:46 -0000	1.3
+++ edit_acls.tmpl	13 Jan 2004 16:05:49 -0000	1.4
@@ -12,124 +12,129 @@
 <tr>
 <td colspan=2>                        
 <table border=1>
-                <tr class=header>
-                        <td><perl>_("Protected area")</perl></td>
-                        <td><perl>_("Allowed users")</perl></td>
-                        <td colspan=2>&nbsp;</td>                               
-                </tr>
-            <perl>
-           my $ACLs=$ispman->getAcls($r->param("ispmanDomain"), $r->param('ispmanVhostName'));
-           my $text="";
-           if ($ACLs){
-                $text.="<tr><td colspan=4 class=control>";
-                $text.=_("The following rules are defined ");
-                $text.="</td></tr>";
-                
-                my $vhost = join '.', ($r->param("ispmanVhostName"), $r->param('ispmanDomain'));
-                $text.= $vhost;
-                $text.="<br><br>";
+	<tr class=header>
+			<td><perl>_("Protected area")</perl></td>
+			<td><perl>_("Allowed users")</perl></td>
+			<td colspan=2>&nbsp;</td>                               
+	</tr>
+	<perl>
+		my $ACLs=$ispman->getAcls($r->param("ispmanDomain"), $r->param('ispmanVhostName'));
+		my $text="";
+		if ($ACLs){
+			$text.="<tr><td colspan=4 class=control>";
+			$text.=_("The following rules are defined ");
+			$text.="</td></tr>";
+			
+			my $vhost = join '.', ($r->param("ispmanVhostName"), $r->param('ispmanDomain'));
+			$text.= $vhost;
+			$text.="<br><br>";
                 
                 
-                for (sort {length($b) <=> length($a)} keys %$ACLs){ 
-                        $text.="<tr>";
-                        if ($r->param("ispmanVhostAclLocation") && $r->param("ispmanVhostAclLocation") eq $ACLs->{$_}{'ispmanVhostAclLocation'}){
-                                $text.=qq|\n<form>\n<td valign=top><input type=text name=ispmanVhostAclLocation value='$ACLs->{$_}{'ispmanVhostAclLocation'}'></td>
-                                <td valign=top> <select name=ispmanVhostAclAllowUser multiple size=5>|;
-                                   my $allowedUsers={};
-                                   for my $allowedUser (@{$ACLs->{$_}{'ispmanVhostAclAllowUser'}}){
-                                        $allowedUsers->{$allowedUser}++;
-                                   }
-                                   
-                                   my $webusers=$ispman->getWebusers($r->param('ispmanDomain'));
-                                    for $webuser(keys %$webusers){
-                                        $text.="<option value='$webusers->{$webuser}{'ispmanUserId'}'";
-                                        if ($allowedUsers->{$webusers->{$webuser}{'ispmanUserId'}}) {
-                                                $text.=" selected ";
-                                        }
-                                        $text.=">webuser: $webusers->{$webuser}{'ispmanUserId'}</option>\n";
-                                        
-                                    }
-                                    my $domainusers=$ispman->getDomainUsersForDomain($r->param('ispmanDomain'));
-                                    for $domainuser(keys %$domainusers){
-                                        $text.="<option value='$domainuser'";
-                                        if ($allowedUsers->{$domainuser}) {
-                                                $text.=" selected ";
-                                        }
-                                        $text.=">domainuser: $domainuser</option>\n";
-                                        
-                                    }
+			for (sort {length($b) <=> length($a)} keys %$ACLs){ 
+				$text.="<tr>";
+				if ($r->param("ispmanVhostAclLocation") && $r->param("ispmanVhostAclLocation") eq $ACLs->{$_}{'ispmanVhostAclLocation'}){
+					$text.=qq|\n<form name=ACLEditForm>\n
+					<td valign=top>
+					$ACLs->{$_}{'ispmanVhostAclLocation'}
+					</td>
+						<td valign=top> <select name=ispmanVhostAclAllowUser multiple size=5>|;
+					my $allowedUsers={};
+					for my $allowedUser ($ispman->as_array($ACLs->{$_}{'ispmanVhostAclAllowUser'})){
+						$allowedUsers->{$allowedUser}++;
+					}
                                    
+					my $webusers=$ispman->getWebusers($r->param('ispmanDomain'));
+					for $webuser(keys %$webusers){
+						$text.="<option value='$webusers->{$webuser}{'ispmanUserId'}'";
+						if ($allowedUsers->{$webusers->{$webuser}{'ispmanUserId'}}) {
+							$text.=" selected ";
+						}
+						$text.=">webuser: $webusers->{$webuser}{'ispmanUserId'}</option>\n";
+					}
+					my $domainusers=$ispman->getDomainUsersForDomain($r->param('ispmanDomain'));
+					for $domainuser(keys %$domainusers){
+						my $exploded_dn=$ispman->explodeDN($domainusers->{$domainuser});
+						my $uid=$exploded_dn->{'uid'};
+						$text.="<option value='$uid'";
+						if ($allowedUsers->{$uid}) {
+							$text.=" selected ";
+						}
+						$text.=">domainuser: $uid</option>\n";
+					}
+					$text.=qq|
+					</select>
+					</td>
+					<td><input type=submit value='@{[_("update")]}'></td>
+					<input type=hidden name=ispmanVhostAclLocation value="$ACLs->{$_}{'ispmanVhostAclLocation'}">
+					<input type=hidden name=ispmanDomain value="@{[$r->param('ispmanDomain')]}">
+					<input type=hidden name=ispmanVhostName value="@{[$r->param('ispmanVhostName')]}">
+					<input type=hidden name=mode value="updateVhostAcl">
+					</form>
+					<td><a href="@{[$r->url]}?mode=deleteVhostAcl&section=acls&ispmanDomain=@{[$r->param("ispmanDomain")]}&ispmanVhostName=@{[$r->param("ispmanVhostName")]}&ispmanVhostAclLocation=$ACLs->{$_}{'ispmanVhostAclLocation'}">@{[_('Delete')]}</a></td>
+					|;
+				} else {
+					$text.=qq|
+						<td><font color=blue>$ACLs->{$_}{'ispmanVhostAclLocation'}</font></td>
+						<td> <font color=green>|;
+					if (ref $ACLs->{$_}{'ispmanVhostAclAllowUser'} eq "ARRAY") {
+						$text.= join ', ', @{$ACLs->{$_}{'ispmanVhostAclAllowUser'}};
+					} else {
+						$text.=$ACLs->{$_}{'ispmanVhostAclAllowUser'};
+					}
                                 
-                                $text.=qq|
-                                </select>
-                                </td>
-                                <td><input type=button value='@{[_("update")]}' onClick='updateAcl()'></td>
-                                <input type=hidden name=ispmanVhostAclLocation value="$ACLs->{$_}{'ispmanVhostAclLocation'}">
-                                <input type=hidden name=ispmanVhostAclLocation value="$ACLs->{$_}{'ispmanVhostAclLocation'}">
-                                <input type=hidden name=dn value="$_">
-                                <td><a href="@{[$r->url]}?mode=deleteWebsiteAcl&section=acls&ispmanVhostName@{[$r->param("ispmanVhostName")]}&ispmanVhostAclLocation=$ACLs->{$_}{'ispmanVhostAclLocation'}">@{[_('Delete')]}</a></td>
-                                |;
-                        } else {
-                                $text.=qq|
-                                <td><font color=blue>$ACLs->{$_}{'ispmanVhostAclLocation'}</font></td>
-                                <td> <font color=green>|;
-                                if (ref $ACLs->{$_}{'ispmanVhostAclAllowUser'} eq "ARRAY") {
-                                        $text.= join ', ', @{$ACLs->{$_}{'ispmanVhostAclAllowUser'}};
-                                } else {
-                                        $text.=$ACLs->{$_}{'ispmanVhostAclAllowUser'};
-                                }
-                                
-                                $text.=qq|
-                                </font></td>
-                                <td><a href="@{[$r->url]}?mode=editVhost&section=acls&ispmanVhostName=@{[$r->param("ispmanVhostName")]}&ispmanDomain=@{[$r->param("ispmanDomain")]}&ispmanVhostAclLocation=$ACLs->{$_}{'ispmanVhostAclLocation'}">@{[_('Edit')]}</a></td>
-                                <td><a href="@{[$r->url]}?mode=deleteWebsiteAcl&ispmanDomain=@{[$r->param("ispmanDomain")]}&section=acls&ispmanVhostName=@{[$r->param("ispmanVhostName")]}&ispmanVhostAclLocation=$ACLs->{$_}{'ispmanVhostAclLocation'}">@{[_('Delete')]}</a></td>
-                                |;
-                        }
+					$text.=qq|
+						</font></td>
+						<td><a href="@{[$r->url]}?mode=editVhost&section=acls&ispmanVhostName=@{[$r->param("ispmanVhostName")]}&ispmanDomain=@{[$r->param("ispmanDomain")]}&ispmanVhostAclLocation=$ACLs->{$_}{'ispmanVhostAclLocation'}">@{[_('Edit')]}</a></td>
+						<td><a href="@{[$r->url]}?mode=deleteVhostAcl&ispmanDomain=@{[$r->param("ispmanDomain")]}&section=acls&ispmanVhostName=@{[$r->param("ispmanVhostName")]}&ispmanVhostAclLocation=$ACLs->{$_}{'ispmanVhostAclLocation'}">@{[_('Delete')]}</a></td>
+						|;
+				}
                         
-                        $text.="<tr>";
-                }
-            } else {
-                $text.="<tr><td colspan=4 class=control>";
-                $text.=_("No Website ACL defined ");
-                $text.="</td></tr>";
-            }                                        
-            $text
-            </perl>
+				$text.="<tr>";
+			}
+		} else {
+			$text.="<tr><td colspan=4 class=control>";
+			$text.=_("No Website ACL defined ");
+			$text.="</td></tr>";
+		}                                        
+		$text
+	</perl>
                 
-                <tr class=control>
-						<form>
-                        <td valign=top class=control><input type=text name=newIspmanVhostAclLocation value=""></td>
-                        <td valign=top class=control>
-                        <select MULTIPLE size=5 name=newIspmanVhostAclAllowUser>
-                        <perl>
-							$text='';
-                            my $webusers=$ispman->getWebusers($r->param('ispmanDomain'));
-                            for $webuser(keys %$webusers){
-                                $text.="\n<option value='$webusers->{$webuser}{'ispmanUserId'}'>webuser: $webusers->{$webuser}{'ispmanUserId'}</option>";
-                            }
-                            $text
-                        </perl>
-                        
-                        <perl>
-                            $text="";
-                            my $users=$ispman->getDomainUsersForDomain($r->param('ispmanDomain'));
-				            for my $user(keys %$users) {
-                                $text.="<option value='$user'>domainuser: $user</option>\n";
-                            }
-                        $text
-                        </perl>
-                        </select>
-                        </td>
-                        <input type=hidden name=mode value="addVhostAcl">
-						<input type=hidden name=ispmanVhostName value="@[{$r->param("ispmanVhostName")}]">
-						<input type=hidden name=ispmanDomain value="@[{$r->param("ispmanDomain")}]">
-                        <td colspan=2><input type=submit value="<perl>_('Add  new protected area')</perl>"></td>
-						</form>
-						
+	<tr class=control>
+		<form name=NewVhostACLForm>
+		<td valign=top class=control><input type=text name=newIspmanVhostAclLocation value=""></td>
+		<td valign=top class=control>
+		<select MULTIPLE size=5 name=newIspmanVhostAclAllowUser>
+		<perl>
+			$text='';
+			my $webusers=$ispman->getWebusers($r->param('ispmanDomain'));
+			for $webuser(keys %$webusers){
+				$text.="\n<option value='$webusers->{$webuser}{'ispmanUserId'}'>webuser: $webusers->{$webuser}{'ispmanUserId'}</option>";
+			}
+			$text
+		</perl>
                         
-                </tr>
-                                                        
-        </table>                
+		<perl>
+			$text="";
+			my $users=$ispman->getDomainUsersForDomain($r->param('ispmanDomain'));
+			for my $user(keys %$users) {
+				my $exploded_dn=$ispman->explodeDN($users->{$user});
+				my $uid=$exploded_dn->{'uid'};
+				$text.="<option value='$uid'>domainuser: $uid</option>\n";
+			}
+			$text
+		</perl>
+		</select>
+		</td>
+		<input type=hidden name=mode value="addVhostAcl">
+		<input type=hidden name=ispmanVhostName value="<perl>$r->param("ispmanVhostName")</perl>">
+		<input type=hidden name=ispmanDomain value="<perl>$r->param("ispmanDomain")</perl>">
+		<td colspan=2><input type=submit value="<perl>_('Add  new protected area')</perl>"></td>
+		</form>
+	</tr>
+</table>                
+
+
+
 </td>
 </tr>
 </table>




-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.