Subversion Repositories WebE

Rev

Rev 30 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

1
<%@taglib uri="/struts-tags" prefix="s"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="contextPath" value="${pageContext.request.contextPath}" />

<html>
  <head>
    <title>User bearbeiten</title>
  </head>
  <body>
    <s:if test="edit">
      <h1>Benutzer bearbeiten</h1>
    </s:if>
    <s:else>
      <h1>Benutzer verwalten</h1>
    </s:else>
    
    <s:if test="added">
      <p>Der Benutzer <b><s:text name="savedUser.username"/>
        <s:if test="savedUser.firstname.length() > 0 || savedUser.lastname.length() > 0))">
          (<s:text name="savedUser.firstname"/> <s:text name="savedUser.lastname"/>)
        </s:if></b>
        wurde hinzugef&uuml;gt.</p>  
    </s:if>
  
    <s:if test="edit">
      <h2>Dieser Benutzer</h2>
    </s:if>
    <s:else>
      <h2>Neuer Benutzer</h2>
    </s:else>    
    
    <s:form action="saveUser">
      <s:hidden name="edit" />
      <s:hidden name="user.id" />
      <s:textfield name="user.username" label="Benutzername" required="true" />
      <s:password name="user.password" label="Passwort" required="true" />
      <s:textfield name="user.firstname" label="Vorname" />
      <s:textfield name="user.lastname" label="Nachname" />
      <s:checkbox name="user.admin" label="Administrator" />
        
      <s:if test="edit">
        <s:submit type="button"><img src="${contextPath}/resources/icons/tick.png" alt="" />
          Speichern</s:submit>
      </s:if>
      <s:else>
        <s:submit type="button"><img src="${contextPath}/resources/icons/add.png" alt="" />
          Hinzuf&uuml;gen
        </s:submit>
      </s:else>      
    </s:form>
    
    <h2>Registrierte Benutzer</h2>
    <s:if test="userList.size() == 0">
      <p>Keine Benutzer gefunden</p>
    </s:if>
    <s:else>
      <table>
        <thead>
                <tr>
                        <th>Benutzername</th>
                        <th>Vorname</th>
                        <th>Nachname</th>
                        <th>Administrator</th>
                </tr>
        </thead>
        <tbody>
          <s:iterator value="userList" status="stat">
                <tr>
                        <td><s:property value="username" /></td>
                        <td><s:property value="firstname" /></td>
                        <td><s:property value="lastname" /></td>
                        <td><s:if test="admin">ja</s:if><s:else>nein</s:else></td>
                        
                        <td><s:url id="editURL" action="editUser">
                                <s:param name="id" value="%{id}"></s:param>
                        </s:url> <s:a href="%{editURL}">
                                <img src="${contextPath}/resources/icons/page_white_edit.png" alt="edit" />
                        </s:a></td>
                        
              <s:if test="!admin">
                        <td><s:url id="deleteURL" action="deleteUser">
                                <s:param name="id" value="%{id}"></s:param>
                        </s:url> <s:a href="%{deleteURL}">
                                <img src="${contextPath}/resources/icons/delete.png" alt="delete" />
                        </s:a></td>
              </s:if>
                </tr>
          </s:iterator>
        </tbody>  
      </table>
    </s:else>    
  </body>
</html>