2016-11-08 3 views
0

이제 웹 사이트 용 관리자 패널이있어서 작은 것들을 시도하기로 결정했지만 아직 도착하지는 않습니다.속도 엔진/자바로 제출할 때 버튼 텍스트 변경

그래서 사용자를 비활성화하거나 활성화 할 때마다 어떤 좋은 일이 있었는지 알려주고 나름대로 좋은 소식을 듣게됩니다.하지만 당연히 버튼은 그대로 유지됩니다. 기능에 따라 이것을 바꿀 수있는 방법이 있습니까?

#parse("/velocity/layout.vm") 
#@mainLayout() 
<table id="adminPanel"> 
    <tr> 
     <th>Email</th> 
     <th>Name</th> 
     <th>Reset Password</th> 
     <th>IsActive</th> 
     <th>Delete</th> 
    </tr> 
    #if($resetpassword) 
     <p class="good notification">$msg.get("RESET_PASSWORD")</p> 
    #elseif($blockuser) 
     <p class="bad notification">$msg.get("BLOCK_USER")</p> 
    #elseif($unblockuser) 
     <p class="good notification">$msg.get("UNBLOCK_USER")</p> 
    #elseif($deleteuser) 
     <p class="bad notification">$msg.get("DELETE_USER")</p> 
    #end 
    #foreach($user in $users) 
     #if($user.getIsadmin()) 
       <div class="col"> 
        <tr> 
         <th>$user.getEmail()</th> 
         <th>$user.getFirstname() $user.getSurname()</th> 
         <th><form method="post"> 
          <input type="hidden" name="post" value="reset"> 
          <input type="hidden" name="email" value="$user.getEmail()"> 
          <input type="submit" value="Reset Password" disabled> 
         </form></th></th> 
         <th><form method="post"> 
          <input type="hidden" name="post" value="block"> 
          <input type="hidden" name="email" value="$$user.getEmail()"> 
          <input type="submit" value="IsActive" disabled> 
         </form></th></th> 
         <th><form method="post"> 
          <input type="hidden" name="post" value="delete"> 
          <input type="hidden" name="email" value="$user.getEmail()"> 
          <input id="button" type="submit" value="Delete" disabled> 
         </form></th> 
        </tr> 
       </div> 
      #else 
       <div class="col"> 
        <tr> 
         <th>$user.getEmail()</th> 
         <th>$user.getFirstname() $user.getSurname()</th> 
         <th><form method="post"> 
          <input type="hidden" name="post" value="reset"> 
          <input type="hidden" name="email" value="$user.getEmail()"> 
          <input type="submit" value="Reset Password"> 
         </form></th></th> 
         <th><form method="post"> 
          <input type="hidden" name="post" value="block"> 
          <input type="hidden" name="email" value="$user.getEmail()"> 
          <input type="submit" value="Disable"> 
         </form></th></th> 
         <th><form method="post"> 
          <input type="hidden" name="post" value="delete"> 
          <input type="hidden" name="email" value="$user.getEmail()"> 
          <input type="submit" value="Delete"> 
         </form></th> 
        </tr> 
       </div> 
      #end 
     #end 
</table> 
#end 

답변

1

그것은 당신이 텍스트를 원하는버튼을 변경하는 것에 대한 질문에 매우 불분명하다. 코드에는 버튼이 2 개만 표시되므로이 작업을 수행하도록 권장 할 수 있습니다 (User 객체에 사용자가 차단되었는지 여부를 알 수있는 충분한 정보가 있다고 가정).

<input type="button" #if ($user.isBlocked()) value="Unblock" #else value="Block" #end>