<%	
	import org.exoplatform.webui.form.UIFormPopupWindow;
	import org.exoplatform.webui.form.UIFormGrid;
	import org.exoplatform.webui.form.input.UICheckBoxInput;
	
	def rcontext = _ctx.getRequestContext();	
 	def uiPublicMode = uicomponent.getChildById("publicMode");
 	
 	def popupId = uicomponent.getChild(UIFormPopupWindow.class).getId();
 	def btn = "#$uicomponent.id .uiAction > a";
	rcontext.getJavascriptManager().require("SHARED/jquery", "\$").require("SHARED/uiPopupWindow", "uiPopupWindow")
			  .addScripts("\$('$btn').click(function() {uiPopupWindow.show('$popupId')});");
%>
<div id="<%=uicomponent.getId();%>" class="uiAccessGroup uiForm">
	<div class="publicCheck form-horizontal">
		<div class="control-group">
				<label class="control-label" for="publicMode"><%=uicomponent.getLabel(uiPublicMode.getId())%></label>
				<div class="controls"><%uicomponent.renderChild(UICheckBoxInput.class)%></div>
		</div>
	</div>

	<%
	if(!uicomponent.isPublicMode()) {
		uicomponent.renderChild(UIFormGrid.class);
		uicomponent.renderChild(UIFormPopupWindow.class);
	%>
	<div class="uiAction uiActionBorder"> 
		<a href="javascript:void(0);" class="btn btn-primary"><i class="uiIconAddUser uiIconWhite"> </i> <%=_ctx.appRes("UIListPermissionSelector.action.addPermission")%></a>
	</div>
	<%}%>
</div>