?? security-form-multiple-allows.vm
字號:
#*
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*#
<table bgcolor="#ffffff" cellpadding="5">
#if ($msg)
<tr>
<td colspan="2">
<table bgcolor="#ffffff">
<tr>
<td>
$msg
</td>
</tr>
</table>
</td>
</tr>
#end
</table>
#if ($mode == "delete")
<form name="SecurityForm" method="post" action="$jslink.getPaneByName("SecurityBrowser").setAction("portlets.SecurityUpdateAction")">
<table>
<tr>
<td colspan="2">Are you sure you want do delete this security entry?</td>
</tr>
<tr>
#formReadOnlyCell ("Name" "security_name" $!entry.Name)
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="5" width="30%">
<tr>
<td>
<input type="submit" name="eventSubmit_doDelete" value="Delete Security Entry"/>
</td>
</tr>
</table>
</form>
#elseif($mode == "insert")
<form name="SecurityForm" method="post" action="$jslink.getPaneByName("SecurityForm").setAction("portlets.SecurityUpdateAction")">
<table>
<input type="hidden" name="mode" value="update"/>
<tr>
<td bgcolor="$!{skin.TitleBackgroundColor}">
<b><font face="$ui.sansSerifFonts">Name</font></b>
</td>
<td bgcolor="$!{skin.TitleBackgroundColor}">
<font face="$ui.sansSerifFonts">
<input type="text" size="30" name="security_name" value="$!data.user.getTemp("security_name")"/>
</font>
</td>
</tr>
<tr>
<td bgcolor="$!{skin.TitleBackgroundColor}">
<b><font face="$ui.sansSerifFonts">Title</font></b>
</td>
<td bgcolor="$!{skin.TitleBackgroundColor}">
<font face="$ui.sansSerifFonts">
<input type="text" size="50" name="title" value="$!data.user.getTemp("title")">
</font>
</td>
</tr>
<!--Consider making text area-->
<tr>
<td bgcolor="$!{skin.TitleBackgroundColor}">
<b><font face="$ui.sansSerifFonts">Description</font></b>
</td>
<td bgcolor="$!{skin.TitleBackgroundColor}">
<font face="$ui.sansSerifFonts">
<textarea rows="10" cols="50" size="50" name="description">$!data.user.getTemp("description")</textarea>
</font>
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="5" width="30%">
<tr>
<td>
<input type="submit" name="eventSubmit_doInsert" value="Insert Security"/>
</td>
</tr>
</table>
</form>
#elseif($mode == "update")
#if($subMode == "allow")
##Remove Form
<form method="post" action="$jslink.getPaneByName("SecurityForm").setAction("portlets.SecurityUpdateAction")">
<input type="hidden" name="mode" value="update"/>
<input type="hidden" name="access_index" value="$!accessIndex"/>
<input type="hidden" name="security_name" value="$!entry.name"/>
Current Access: $securityAccess.action
<hr />
<br />
Allows
<table>
#foreach($allow in $securityAccess.getAllows())
<tr>
<td><input type="checkbox" name="allow_index" value="$!velocityCount"/></td>
<td>
#if($allow.user)
$allow.user
#elseif($allow.role)
$allow.role
#end
</td>
</tr>
#end
#if($securityAccess.getAllows().size() > 0)
<tr>
<td colspan="2"><input type="submit" name="eventSubmit_doRemoveallow" value="Remove Allow"/>
</tr>
#end
</table>
</form>
<hr />
<br />
Owner Allows
<form method="post" action="$jslink.getPaneByName("SecurityForm").setAction("portlets.SecurityUpdateAction")">
<input type="hidden" name="mode" value="update"/>
<input type="hidden" name="access_index" value="$!accessIndex"/>
<input type="hidden" name="security_name" value="$!entry.name"/>
<input type="hidden" name="allow_type" value="owner"/>
<table>
#foreach($allow in $securityAccess.getOwnerAllows())
<tr>
<td><input type="checkbox" name="allow_index" value="$!velocityCount"/></td>
<td>
#if($allow.user)
$allow.user
#elseif($allow.role)
$allow.role
#elseif($allow.owner)
$allow.owner
#end
</td>
</tr>
#end
#if($securityAccess.getOwnerAllows().size() > 0)
<tr>
<td colspan="2"><input type="submit" name="eventSubmit_doRemoveallow" value="Remove Allow"/>
</tr>
#end
</table>
</form>
<hr />
<br />
##Add new allow to access form
<form method="post" action="$jslink.getPaneByName("SecurityForm").setAction("portlets.SecurityUpdateAction")">
<input type="hidden" name="mode" value="update"/>
<input type="hidden" name="access_index" value="$!accessIndex"/>
<input type="hidden" name="security_name" value="$!entry.name"/>
<table>
<tr>
<td>Type</td>
<td>
<select name="allow_type">
<option value="user">User</option>
<option value="role">Role</option>
<option value="owner">Owner</option>
</select>
</td>
</tr>
<tr>
<td>Value</td>
<td><input type="text" name="allow_value" value="$!data.parameters.getString("allow_value")"/>
</tr>
<tr>
<td><input type="submit" name="eventSubmit_doAddallow" value="Add Allow"/>
</tr>
</table>
</form>
<br />
<form method="post" action="$jslink.getPaneByName("SecurityForm").setAction("portlets.SecurityUpdateAction")">
<input type="hidden" name="mode" value="update"/>
<input type="hidden" name="security_name" value="$!entry.name"/>
<input type="submit" value="Back to Security Entry"/>
</form>
#else
<form name="SecurityForm" method="post" action="$jslink.getPaneByName("SecurityForm").setAction("portlets.SecurityUpdateAction")">
<table>
<input type="hidden" name="mode" value="update"/>
<tr>
#formReadOnlyCell ("Name" "security_name" $!entry.Name)
</tr>
<tr>
<td bgcolor="$!{skin.TitleBackgroundColor}">
<b><font face="$ui.sansSerifFonts">Title</font></b>
</td>
<td bgcolor="$!{skin.TitleBackgroundColor}">
<font face="$ui.sansSerifFonts">
<input type="text" size="50" name="title" value="$!entry.title">
</font>
</td>
</tr>
<!--Consider making text area-->
<tr>
<td bgcolor="$!{skin.TitleBackgroundColor}">
<b><font face="$ui.sansSerifFonts">Description</font></b>
</td>
<td bgcolor="$!{skin.TitleBackgroundColor}">
<font face="$ui.sansSerifFonts">
<textarea rows="10" cols="50" size="50" name="description">$!entry.description</textarea>
</font>
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="5" width="30%">
<tr>
<td>
<input type="submit" name="eventSubmit_doUpdate" value="Update Security"/>
</td>
</tr>
</table>
</form>
<form method="post" action="$jslink.getPaneByName("SecurityForm").setAction("portlets.SecurityUpdateAction")">
<input type="hidden" name="mode" value="update"/>
<input type="hidden" name="security_name" value="$!entry.name"/>
<table border="1">
##<th> </th>
##<th>Action</th>
##<th>Allows</th>
#foreach($securityAccess in $entry.getAccesses())
<tr>
<td><input type="checkbox" name="access_index" value="$!velocityCount"/></td>
<td>
$securityAccess.action
</td>
<td>
<a href="$jslink.getPaneByName("SecurityForm").setAction("portlets.SecurityUpdateAction").addQueryData("mode", "update").addQueryData("security_name",$entry.name).addQueryData("access_index",$velocityCount).addQueryData("subMode", "allow")">More</a>
</td>
</tr>
#end
#if($entry.getAccesses().size() > 0)
<tr>
<td colspan="3"><input type="submit" name="eventSubmit_doRemoveaccess" value="Remove Access"/>
</tr>
#end
</table>
</form>
<!--Add a new action entry-->
<script>
var userSelect = new Array;
var roleSelect = new Array;
var populated = false;
function populate()
{
#foreach($user in $users)
#set($myCount = $velocityCount - 1)
var userOption$myCount = new Option;
userOption${myCount}.value = "$user.userName";
userOption${myCount}.text = "$user.userName";
userSelect[$myCount] = userOption$myCount;
#end
#foreach($role in $roles)
#set($myCount = $velocityCount - 1)
var roleOption$myCount = new Option;
roleOption${myCount}.value = "$role.name";
roleOption${myCount}.text = "$role.name";
roleSelect[$myCount] = roleOption$myCount;
#end
populated = true;
}
function changeList(selectAction)
{
if(!populated)
{
populate();
}
var val = selectAction.options[selectAction.selectedIndex].value;
var newOpts = new Array;
if(val == "user")
{
newOpts = userSelect;
}
else if(val == "role")
{
newOpts = roleSelect;
}
var select = document.NewSecurity.allow_value;
for(var i=0; i<newOpts.length; i++)
{
select.options[i] = newOpts[i];
}
for(var j=newOpts.length; j<select.options.length; j++)
{
select.options[j] = new Option;
}
}
</script>
<form name="NewSecurity" method="post" action="$jslink.getPaneByName("SecurityForm").setAction("portlets.SecurityUpdateAction")">
<input type="hidden" name="mode" value="update"/>
<input type="hidden" name="security_name" value="$!entry.name"/>
<table>
<tr>
<td>Action</td>
<td>
<select name="access_action" >
<option value="*">*</option>
#foreach($permission in $permissions)
<option value="$!permission.name" #if($data.user.getTemp("access_action") == $permission.name) selected="true" #end>$!permission.name</option>
#end
</select>
</td>
</tr>
<tr>
<td>Type</td>
<td>
<select name="allow_type" onChange="changeList(this); return true;">
<option value="owner">Owner</option>
<option value="user">User</option>
<option value="role">Role</option>
</select>
</td>
</tr>
<tr>
<td>Value</td>
##<td><input type="text" name="allow_value" value="$!data.parameters.getString("allow_value")"/></td>
<td>
<select name="allow_value">
#*
#foreach($user in $users)
<option value="$user.name">$user.userName</option>
#end
*#
</select>
</td>
</tr>
<tr>
<td><input type="submit" name="eventSubmit_doAddaccess" value="Add Security Access"/>
</tr>
</table>
</form>
#end
##ends else of subMode==allow
#end
<table>
<tr>
<td>
<form name="BackToBrowserForm" method="post" action="$jslink.getPaneByName("SecurityBrowser").setAction("portlets.SecurityUpdateAction")">
<input type="submit" name="eventSubmit_doCancel" value="Back to Browser"/>
</form>
</td>
</tr>
</table>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -