<tmpl_include name="inc.head.tmpl">
<tmpl_include name="inc.subhead.tmpl">
<tmpl_include name="inc.adminmenu.tmpl">
<tmpl_if name="new_msg">
	<table cellpadding="5" cellspacing="0" border="0" width="100%">
		<tr>
			<td align="center" bgcolor="<tmpl_var name="table_header_bg">">
				<strong><tmpl_var escape="html" name="message"></strong>
			</td>
		</tr>
	</table>
</tmpl_if>
<script src="js/functions.js" type="text/javascript"></script>
<script src="js/adminSettings.js" type="text/javascript"></script>
<script src="js/fluxdSettings.js" type="text/javascript"></script>
<div align="center">
	<a name="fluxd" id="fluxd"></a>
	<tmpl_if name="pageop" value="default">
		<table width="100%" border=1 bordercolor="<tmpl_var name="table_admin_border">" cellpadding="2" cellspacing="0" bgcolor="<tmpl_var name="table_data_bg">">
			<tr>
				<td colspan="<tmpl_if name="with_profiles">4<tmpl_else>3</tmpl_if>" bgcolor="<tmpl_var name="table_header_bg">" background="themes/<tmpl_var name="theme">/images/bar.gif">
					<img src="themes/tf_standard_themes/images/properties.png" width=18 height=13 border=0>&nbsp;&nbsp;<font class="title">Jobs</font>
				</td>
			</tr>
			<tmpl_if name="watch_jobs">
				<tr bgcolor="<tmpl_var name="table_border_dk">">
					<td align="center">&nbsp;</td>
					<td align="center">Watchdir</td>
					<td align="center">User</td>
					<tmpl_if name="with_profiles">
						<td align="center">Transfer Profile</td>
					</tmpl_if>
				</tr>
				<tmpl_loop name="watch_jobs">
					<tr>
						<td>
							<a href="admin.php?op=fluxdWatchSettings&pageop=deleteJob&job=<tmpl_var name="__ROWNUM__">"  onclick="return confirm('Delete Job ?')"><img src="themes/tf_standard_themes/images/delete_on.gif" width=16 height=16 border=0 title="Delete Job" align="absmiddle"></a>&nbsp;
							<a href="admin.php?op=fluxdWatchSettings&pageop=editJob&job=<tmpl_var name="__ROWNUM__">"><img src="themes/tf_standard_themes/images/edit.gif" width=16 height=16 border=0 title="Edit Job" align="absmiddle"></a>&nbsp;
						</td>
						<td>
							<tmpl_var escape="htmlkeepspaces" name="D">
						</td>
						<td>
							<tmpl_var escape="htmlkeepspaces" name="U">
						</td>
						<tmpl_if name="with_profiles">
							<td>
								<tmpl_if name="P" value="">
									&nbsp;
								<tmpl_else>
									<tmpl_var escape="htmlkeepspaces" name="P">
								</tmpl_if>
							</td>
						</tmpl_if>
					</tr>
				</tmpl_loop>
			<tmpl_else>
				<tr>
					<td colspan="<tmpl_if name="with_profiles">4<tmpl_else>3</tmpl_if>">
						<strong>No Jobs defined.</strong>
					</td>
				</tr>
			</tmpl_if>
			<tr>
				<td colspan="<tmpl_if name="with_profiles">4<tmpl_else>3</tmpl_if>" align="center">
					<form action="admin.php?op=fluxdWatchSettings" method="post">
						<input type="hidden" name="pageop" value="addJob">
						<input type="Submit" value="Add Job">
					</form>
				</td>
			</tr>
		</table>
	<tmpl_elseif name="pageop2" value="addJobOReditJob">
		<form name="theForm" action="admin.php?op=fluxdWatchSettings" method="post" onsubmit="return validateSettings('fluxd_Watch_job')">
			<table width="100%" border=1 bordercolor="<tmpl_var name="table_admin_border">" cellpadding="2" cellspacing="0" bgcolor="<tmpl_var name="table_data_bg">">
				<tr>
					<td colspan="<tmpl_if name="with_profiles">3<tmpl_else>2</tmpl_if>" bgcolor="<tmpl_var name="table_header_bg">" background="themes/<tmpl_var name="theme">/images/bar.gif">
						<img src="themes/tf_standard_themes/images/properties.png" width=18 height=13 border=0>&nbsp;&nbsp;<font class="title"><tmpl_if name="pageop" value="addJob">Add<tmpl_else>Edit</tmpl_if> Job</font>
					</td>
				</tr>
				<tr>
					<td colspan="<tmpl_if name="with_profiles">3<tmpl_else>2</tmpl_if>">
						<div style="width:600px">
						<strong>Overview:</strong><br/>
						<tmpl_if name="with_profiles">
						Specify the watch directory you want to watch for new torrents, the user you want the torrent to be owned by in torrentflux-b4rt and the transfer profile to use for the torrent.  Click 'Add Job' to add the watch job.<br/><br/>

						When fluxd finds a new torrent in the watch directory it will automatically inject the torrent into torrentflux-b4rt using the transfer profile you specify from the 'Transfer Profile' dropdown list and set the owner of the transfer to the user you chose.
						<tmpl_else>
						Specify the watch directory you want to watch for new torrents and the user you want the torrent to be owned by in torrentflux-b4rt.  Click 'Add Job' to add the watch job.<br/><br/>

						When fluxd finds a new torrent in the watch directory it will automatically inject the torrent into torrentflux-b4rt and set the owner of the transfer to the user you chose.
						</tmpl_if>
						</div>
					</td>
				</tr>
				<tmpl_if name="watch_job_loaded">
					<tr bgcolor="<tmpl_var name="table_border_dk">">
						<td align="center"><label for="watchdir">Watchdir</label></td>
						<td align="center"><label for="user">User</label></td>
						<tmpl_if name="with_profiles">
							<td align="center"><label for="profile">Transfer Profile</label></td>
						</tmpl_if>
					</tr>
					<tr>
						<td>
							<input type="text" style="width: 100%;" size="40" maxlength="255" name="watchdir" id="watchdir" value="<tmpl_var escape="html" name="watchdir">">
						</td>
						<td width="100">
							<select name="user" id="user"<tmpl_if name="with_profiles"> onchange="performRefresh();"</tmpl_if>>
								<tmpl_loop name="watch_users">
									<option value="<tmpl_var escape="html" name="name">"<tmpl_if name="is_selected"> selected</tmpl_if>><tmpl_var escape="htmlkeepspaces" name="name"></option>
								</tmpl_loop>
							</select>
						</td>
						<tmpl_if name="with_profiles">
							<td width="150">
								<select name="profile" id="profile">
									<option value="">default</option>
									<tmpl_if name="profiles">
										<tmpl_loop name="profiles">
											<option value="<tmpl_var escape="html" name="name">"<tmpl_if name="is_selected"> selected</tmpl_if>><tmpl_var escape="htmlkeepspaces" name="name"></option>
										</tmpl_loop>
									</tmpl_if>
									<tmpl_if name="public_profiles">
										<optgroup label="Public" style="background-color: #00EC00">
											<tmpl_loop name="public_profiles">
												<option style="background-color: #FFFFFF" value="<tmpl_var escape="html" name="name">"<tmpl_if name="is_selected"> selected</tmpl_if>><tmpl_var escape="htmlkeepspaces" name="name"></option>
											</tmpl_loop>
										</optgroup>
									</tmpl_if>
								</select>
							</td>
						</tmpl_if>
					</tr>
					<tr>
						<td colspan="<tmpl_if name="with_profiles">3<tmpl_else>2</tmpl_if>" align="center">
							<label for="checkdir">Check/Create dir</label> <input type="checkbox" name="checkdir" id="checkdir"<tmpl_if name="checkdir"> checked</tmpl_if>>
							<br>
							<input type="hidden" name="pageop" value="<tmpl_var escape="html" name="pageop">">
							<input type="hidden" name="job" value="<tmpl_var escape="html" name="jobnumber">">
							<input type="hidden" name="postback" value="1">
							<input type="hidden" name="refresh" value="0">
							<input type="Submit" value="<tmpl_if name="pageop" value="addJob">Add<tmpl_else>Edit</tmpl_if> Job">
						</td>
					</tr>
				<tmpl_else>
					<tr>
						<td colspan="<tmpl_if name="with_profiles">3<tmpl_else>2</tmpl_if>">
							<strong>Error loading Job</strong>
							<br>
							<tmpl_if name="messages">
								<ul>
									<tmpl_loop name="messages">
										<li><tmpl_var escape="html" name="msg"></li>
									</tmpl_loop>
								</ul>
							</tmpl_if>
						</td>
					</tr>
				</tmpl_if>
			</table>
		</form>
		<div align="center">[<a href="admin.php?op=fluxdWatchSettings">Return to fluxd-Watch-Settings</a>]</div>
	<tmpl_elseif name="pageop2" value="saveJob">
		<table width="100%" border=1 bordercolor="<tmpl_var name="table_admin_border">" cellpadding="2" cellspacing="0" bgcolor="<tmpl_var name="table_data_bg">">
			<tr>
				<td bgcolor="<tmpl_var name="table_header_bg">" background="themes/<tmpl_var name="theme">/images/bar.gif">
					<img src="themes/tf_standard_themes/images/properties.png" width=18 height=13 border=0>&nbsp;&nbsp;<font class="title">Save Job</font>
				</td>
			</tr>
			<tr>
				<td>
					<br>
					<tmpl_if name="watch_job_saved" value="1">
						<strong><tmpl_var escape="html" name="watch_job_message"></strong>
					<tmpl_else>
						<strong>Error saving Job</strong>
						<br>
						<tmpl_if name="messages">
							<ul>
								<tmpl_loop name="messages">
									<li><tmpl_var escape="html" name="msg"></li>
								</tmpl_loop>
							</ul>
						</tmpl_if>
					</tmpl_if>
				</td>
			</tr>
		</table>
		<div align="center">[<a href="admin.php?op=fluxdWatchSettings">Return to fluxd-Watch-Settings</a>]</div>
	<tmpl_elseif name="pageop" value="deleteJob">
		<table width="100%" border=1 bordercolor="<tmpl_var name="table_admin_border">" cellpadding="2" cellspacing="0" bgcolor="<tmpl_var name="table_data_bg">">
			<tr>
				<td bgcolor="<tmpl_var name="table_header_bg">" background="themes/<tmpl_var name="theme">/images/bar.gif">
					<img src="themes/tf_standard_themes/images/properties.png" width=18 height=13 border=0>&nbsp;&nbsp;<font class="title">Delete Job</font>
				</td>
			</tr>
			<tr>
				<td>
					<br>
					<tmpl_if name="watch_job_deleted" value="1">
						<strong>Job deleted.</strong>
					<tmpl_else>
						<strong>Error deleting Job</strong>
						<br>
						<tmpl_if name="messages">
							<ul>
								<tmpl_loop name="messages">
									<li><tmpl_var escape="html" name="msg"></li>
								</tmpl_loop>
							</ul>
						</tmpl_if>
					</tmpl_if>
				</td>
			</tr>
		</table>
		<div align="center">[<a href="admin.php?op=fluxdWatchSettings">Return to fluxd-Watch-Settings</a>]</div>
	</tmpl_if>
</div>
<tmpl_include name="inc.subfoot.tmpl">
