#!/mod/bin/jimsh

puts {

<div id=jbar></div>

<ul id=optmenu class=contextMenu style="width: 160px">
	<li class=delete><a href=#delete>Delete</a></li>
	<li class=cut><a href=#cut>Cut to clipboard</a></li>
	<li class=pwcopy><a href=#copy>Copy to clipboard</a></li>

	<li class=separator><a href=#rename>Rename</a></li>
	<li><a href=#download>Download</a></li>

}
if {$model eq "HDR"} {
	puts { <li class="separator decrypt"><a href=#decrypt>Decrypt</a></li> }
	puts { <li class="compress"><a href=#strip>Shrink</a></li> }
} else {
	puts { <li class="compress separator"><a href=#strip>Shrink</a></li> }
}
if {[system pkginst ffmpeg]} {
	puts {
		<li><a href=#audio>Extract Audio</a></li>
		<li><a href=#mpg>Extract to MPG</a></li>
	}
}
if $nicesplice {
	puts {
		<li class="cut"><a href=#crop>Crop</a></li>
		<li class="cut"><a href=#chunk>Split (45m parts)</a></li>
	}
}
puts {
	<li class=separator><a href=#lock>Toggle Lock</a></li>
	<li><a href=#new>Toggle New</a></li>
</ul>

<ul id=ooptmenu class=contextMenu style="width: 160px">
	<li class=delete><a href=#delete>Delete</a></li>
	<li class=cut><a href=#cut>Cut to clipboard</a></li>
	<li class=pwcopy><a href=#copy>Copy to clipboard</a></li>

	<li class=separator><a href=#rename>Rename</a></li>
	<li><a href=#download>Download</a></li>
</ul>

<ul id=doptmenu class=contextMenu style="width: 180px">
	<li class=delete><a href=#delete>Delete</a></li>
	<li class=cut><a href=#cut>Cut to clipboard</a></li>
	<li class=pwcopy><a href=#copy>Copy to clipboard</a></li>
	<li class=pwpaste><a href=#paste>Paste to folder</a></li>
	<li class=separator><a href=#rename>Rename</a></li>
	<li class=separator><a href=#resetnew>Reset new flag</a></li>
	<li class="separator compress"><a href=#shrink>Auto-Shrink</a></li>
	<li class=dedup><a href=#dedup>Auto-Dedup</a></li>
}
if {$model eq "HDR"} {
	puts { <li class=decrypt><a href=#decrypt>Auto-Decrypt</a></li> }
}
if $flatten {
	puts { <li class="separator"><a href=#flat>No-Flatten</a></li> }
}

puts {
</ul>

<div id=renameform title="Rename media file" style="display: none">
	<form id=renameform_form>
	<input type=hidden name="renamefile" id="renamefile" value="">
	<table border=0>
	<tr>
	<th>
		<label for="rename">
			<b>New Filename</b>
		</label>
	</th>
	<td>
		<input type=text name="rename" id="rename"
		    value="" size=70 maxlength=255
		    class="text ui-widget-content ui-corner-all">
	</td>
	</tr>

	<tr style="display: none" class=tstype>
	<th>
		<label for="rename_title" style="padding-top: 0.5em">
			<b>New Medialist Title</b>
		</label>
	</th>
	<td>
		<input type=text name="rename_title" id="rename_title"
		    value="" size=70 maxlength=48
		    class="text ui-widget-content ui-corner-all">
	</td>
	</tr>

	<tr style="display: none" class=tstype>
	<th>
		<label for="rename_synopsis" style="padding-top: 0.5em">
			<b>New Synopsis</b>
		</label>
	</th>
	<td>
		<textarea name="rename_synopsis" id="rename_synopsis"
		    value="" cols=70 rows=4
		    class="text ui-widget-content ui-corner-all"></textarea>
	</td>
	</tr>

	<tr style="display: none" class=tstype>
	<th>
		<label for="rename_guidance" style="padding-top: 0.5em">
			<b>New Guidance Text</b>
		</label>
	</th>
	<td>
		<input type=text name="rename_guidance" id="rename_guidance"
		    value="" size=70 maxlength=74
		    class="text ui-widget-content ui-corner-all">
	</td>
	</tr>

	</table>
	</form>
</div>

<div id=drenameform title="Rename directory" style="display: none">
	<form id=drenameform_form>
	<input type=hidden name="renameorig" id="drenameorig" value="">
	<table border=0>
	<tr>
	<th>
		<label for="drename">
			<b>New Directory Name</b>
		</label>
	</th>
	<td>
		<input type=text name="rename" id="drename"
		    value="" size=70 maxlength=255
		    class="text ui-widget-content ui-corner-all">
	</td>
	</tr>
	</table>
	</form>
</div>

<div id=savestreamform title="Save streamed content"
    style="display: none">
	<div class=pre id=savestream_detail></div>
	<form id=savestream_form>
}
puts "<input type=hidden name=dir value=\"$dir\">"
puts {
	<table border=0>
	<tr>
	<th>
		<label for="savestream_name">
			<b>Filename</b>
		</label>
	</th>
	<td>
		<input type=text name="savestream_name"
		    id="savestream_name"
		    value="" size=70 maxlength=255
		    class="text ui-widget-content ui-corner-all">
		<img id=savestream_spin src=/img/loading.gif>
	</td>
	</tr>
	</table>
	</form>
</div>

<div id=newdirform title="New Folder" style="display: none">
	<form id=newdirform_form>
}
puts "<input type=hidden name=dir value=\"$dir\">"
puts {
	<table border=0>
	<tr>
	<th>
		<label for="newdirname">
			<b>New Folder Name</b>
		</label>
	</th>
	<td>
		<input type=text name="newdirname" id="newdirname"
		    value="" size=70 maxlength=255
		    class="text ui-widget-content ui-corner-all">
	</td>
	</tr>
	</table>
	</form>
</div>

<div id=dialogue></div>
<div id=confirm title="Confirmation Required"></div>
<div id=pwdialogue style="display: none">
<center>
<img src=/img/loading.gif>
<br><br>
Please wait...
<div id=pwfeedback></div>
</center>
</div>

}

