<dtml-var manage_page_header>
<dtml-var manage_tabs>

<main class="container-fluid">

	<p class="form-help">
		You can update the data for this file object using the form below.
		Select a data file from your local computer by clicking the <em>browse</em>
		button and click <em>upload</em> to update the contents of the
		file. You may also edit the file content directly if the content is a
		text type and small enough to be edited in a text area.
	</p>

	<form action="<dtml-var "REQUEST.URL1" html_quote>" method="post"
		enctype="multipart/form-data" class="zmi-file zmi-edit">

		<div class="form-group row">
			<label for="title" class="form-label	col-sm-3 col-md-2">Title</label>
			<div class="col-sm-9 col-md-10">
				<input id="title" class="form-control" type="text" name="title"
					value="<dtml-if title>&dtml-title;</dtml-if>" />
			</div>
		</div>

		<div class="form-group row">
			<label for="contenttype" class="form-label	col-sm-3 col-md-2">Content Type</label>
			<div class="col-sm-9 col-md-10">
				<input id="contenttype" class="form-control" type="text" name="content_type:required"
					value="<dtml-if content_type>&dtml-content_type;</dtml-if>" />
				</div>
		</div>

		<div class="form-group row">
			<label for="precondition" class="form-label col-sm-3 col-md-2">Precondition</label>
			<div class="col-sm-9 col-md-10">
				<input id="precondition" class="form-control" type="text" name="precondition"
				value="<dtml-if precondition>&dtml-precondition;</dtml-if>" />
			</div>
		</div>

		<dtml-let ct=getContentType>
			<dtml-if "(ct.startswith('text') or ct.endswith('javascript')) and this().get_size() < 65536">
				<div class="form-group">
					<dtml-try>
						<textarea id="content" <dtml-if content_type>data-contenttype="&dtml-content_type;"</dtml-if>
							class="form-control zmi-file zmi-code col-sm-12"
							name="filedata:text" wrap="off" rows="20"><dtml-var __str__ html_quote></textarea>
					<dtml-except UnicodeDecodeError>
						<div class="alert alert-warning" role="alert">
							The file could not be decoded with '<dtml-var "error_value.encoding">'.
						</div>
					</dtml-try>
				</div>
			<dtml-else>
				<div class="form-group row">
					<label for="size" class="form-label	col-sm-3 col-md-2">File Size</label>
					<div class="form-text col-sm-9 col-md-10">
						<dtml-var size thousands_commas> bytes
					</div>
				</div>
			</dtml-if>
		</dtml-let>

		<div class="zmi-controls">
			<dtml-if wl_isLocked>
				<input class="btn btn-primary disabled" type="submit" name="manage_edit:method" value="Save Changes" disabled="disabled" />
				<span class="badge badge-warning" title="This item has been locked by WebDAV"><i class="fa fa-lock"></i></span>
			<dtml-else>
				<input class="btn btn-primary" type="submit" name="manage_edit:method" value="Save Changes" />
			</dtml-if>
		</div>

</form>

	<dtml-unless wl_isLocked>
		<form action="<dtml-var "REQUEST.URL1" html_quote>" method="post" enctype="multipart/form-data" class="zmi-upload mt-4">
			<div class="input-group" title="Select Local File for Uploading">
				<div class="custom-file">
					<input type="file" name="file" class="custom-file-input" id="file-data" value=""
						onchange="$('.custom-file label span').html($(this).val().replace(/^.*(\\|\/|\:)/, ''));" />
					<label class="custom-file-label" for="file-data"><span>Choose file</span></label>
				</div>
				<div class="input-group-append">
					<input class="btn btn-outline-secondary" type="submit" name="manage_upload:method" value="Upload File" />
				</div>
			</div>
		</form>
	</dtml-unless>

</main>

<dtml-var manage_page_footer>
