<%
  String uploadId = uicomponent.getUploadIds()[0];
  boolean isDynamicMode = uicomponent.isDynamicMode();
  String postUploadActionLink = uicomponent.getPostUploadActionLink();
  def uploadText = _ctx.appRes("UIWikiFormUploadInput.label.UploadLink");
  def rcontext = _ctx.getRequestContext();
  def requireJs = rcontext.getJavascriptManager().getRequireJS();
  requireJs.require("SHARED/UIUpload", "UIUpload").
  addScripts("UIUpload.initUploadEntry(['"+uploadId+"']," + isDynamicMode + ",'" + uploadText +  "');");
%>
<div id="<%=uicomponent.getId()%>">
  <input type="hidden" id="RemoveInputLabel" value="<%= _ctx.appRes("UIWikiFormUploadInput.label.remove-input"); %>"/>
  <div class="uiUploadInput" id="UploadInputContainer<%=uploadId%>">
    <div class="limitMessage" style="display: none;"><%= _ctx.appRes("UIWikiFormUploadInput.msg.limit"); %></div>
    <input type="hidden" id="RemoveInputUrl<%=uploadId%>" value="<%=uicomponent.event('RemoveUploadId', uploadId);%>"/>
    <div id="UploadInput<%=uploadId%>" class="uploadInput"></div>
    <div id="ProgressIframe<%=uploadId%>" class="progressIframe" style="display: none;"></div>      
    <div class="progressBarFrame  clearfix" style="display: none;">
	<span class="deleteFileLabel pull-right">
		<div class="deleteFileLable actionIcon" data-placement="bottom" rel="tooltip" title="<%=_ctx.appRes("UIWikiFormUploadInput.label.cancel")%>">
			<i class="uiIconRemove uiIconLightGray"></i>
		</div>
	</span>
	<div class="percent pull-left">0%</div>
      <div class="progress  progress-striped">
        <div class="bar" style="width:0%"></div>
      </div>      
    </div>

    <div class="selectFileFrame" style="display: none;">
      <div class="fileName">
        <div class="fileNameLabel"><span></span></div>
      </div>
      <div class="removeFile" rel="tooltip" data-placement="bottom" title="<%= _ctx.appRes("UIWikiFormUploadInput.label.remove"); %>"></div>
    </div>
    
    <iframe height="0" width="0" name="UploadIFrame<%=uploadId%>" id="UploadIFrame<%=uploadId%>" style="display: none;">
      <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
      <html xmlns='http://www.w3.org/1999/xhtml'>
        <head></head>
        <body></body>
      </html>
    </iframe>
    
    <div class="postUploadAction" style="display: none;" onclick="$postUploadActionLink"></div>
    <%if(uicomponent.isDynamicMode()) {%>
      <a class='actionLabel' href="javascript:void(0);" onclick="<%=uicomponent.event('CreateUploadId')%>"><%= _ctx.appRes("UIWikiFormUploadInput.label.add-input"); %></a>
    <%}%>
  </div>
</div>
