<%
	import org.exoplatform.web.application.JavascriptManager;
	import org.exoplatform.portal.webui.workspace.UIPortalApplication;

	def rcontext = _ctx.getRequestContext();

	UIPortalApplication uiPortalApp = rcontext.getUIApplication();
	boolean hasPermission = uicomponent.hasPermission();
	if(!uiPortalApp.isEditing() && !hasPermission) return;

	/* ADDED PART BY ECMS */
	if (rcontext.getRequestParameter("noadminbar")!=null) return;
	/* END ADDED PART BY ECMS */

	JavascriptManager jsmanager = rcontext.getJavascriptManager();
	jsmanager.importJavascript('eXo.portal.PortalDragDrop');

%>
<div class="UIContainer UIToolbarContainer <%=uiPortalApp.isEditing()?"EdittingContainer":""%> <%=hasPermission?"": "ProtectedContainer"%>"
				id="${uicomponent.id}"
				onmouseover="eXo.portal.UIPortal.blockOnMouseOver(event, this, true);"
				onmouseout="eXo.portal.UIPortal.blockOnMouseOver(event, this, false);">
	<div class="NormalContainerBlock">
		<div class="LeftContainerBlock">
			<div class="RightContainerBlock UIComponentBlock">

			<%
				int portalMode = uiPortalApp.getModeState();
				String style = "";
				String width	= uicomponent.getWidth();
				String height	= uicomponent.getHeight();
				if(width != null) style += "width:"+width+";";
				if(height != null) style += "height:"+height+";";
				if(portalMode == uiPortalApp.CONTAINER_BLOCK_EDIT_MODE || portalMode == uiPortalApp.APP_BLOCK_EDIT_MODE){
			%>
				<div class="LAYOUT-CONTAINER LAYOUT-BLOCK">
			<%} else {%>
				<div class="VIEW-CONTAINER ToolbarContainer VIEW-BLOCK">
			<%} %>
					<div>
						<%if(hasPermission) {%>
						<div class="UITableColumnContainer" style="margin: 0px auto; $style">
							<div class="TRContainer" style="zoom: 100%;">
								<% for(uiChild in uicomponent.getChildren()) {%>
									<div class="${uiChild.id}TDContainer FloatLeft"><% uicomponent.renderUIComponent(uiChild) %></div>
								<% } %>
								<div class="ClearLeft" style="width: 0px; height: 0px;"><span></span></div>
						 </div>
						</div>
						<%}%>
					</div>
				</div>
				<%/*Debug On IE	-----For DND */%>

			<%if(portalMode != UIPortalApplication.NORMAL_MODE){%>
				<div class="EDITION-BLOCK EDITION-CONTAINER" style="display: none;position: relative;">
					<div style="position: absolute; top: -86px;">
						<div class="NewLayer" style="display: none; visibility: hidden;"><span></span></div>
						<div class="CONTROL-CONTAINER CONTROL-BLOCK UIInfoBar">
							<%/*Begin InfoBar*/%>
							<div class="BlueRoundedStyle">
								<div class="DragControlArea" title="<%=_ctx.appRes("UIContainer.tooltip.drag")%>" onmousedown="eXo.portal.PortalDragDrop.init.call(this,event);"><span></span></div>
								<%
									String strTitle = uicomponent.getTitle() != null ?
												ExpressionUtil.getExpressionValue(res, uicomponent.getTitle()) :
												_ctx.appRes("UIContainer.title.Container");
								%>
								<div class="ContainerIcon DefaultContainer16x16Icon"><%=hasPermission ? strTitle : _ctx.appRes("UIPortlet.label.protectedContent")%></div>
								<%if(hasPermission) {%>
									<a href="<%=uicomponent.event("EditContainer","$uicomponent.id")%>;eXo.portal.UIPortal.changeComposerSaveButton()" class="EditContainerIcon" title="<%=_ctx.appRes("UIContainer.tooltip.editContainer")%>"><span></span></a>
									<a href="<%=uicomponent.event("DeleteComponent","$uicomponent.id")%>" class="DeleteContainerIcon" title="<%=_ctx.appRes("UIContainer.tooltip.closeContainer")%>"><span></span></a>
								<%}%>
							</div>
							<%/*End InfoBar*/ %>
						</div>
					</div>
				</div>
			<%} %>

			</div>
		</div>
	</div>

</div>
