<form name="searchform" method="GET" action="" onsubmit="if(verify(this)) return true; else alert('Some fields are not filled in correctly!'); return false;">
<table>
<tr id="tr_imdbsearch">
<td nowrap>
Search for a movie at IMDb:
</td>
<td>
<input type="hidden" name="go" value="add">
<input type="text" name="imdbsearch" id="text_imdbsearch_1" size="30" value="{$imdbsearch|replace:"\"":"""}" class="textfield">
<input type="submit" name="submit" value="search" class="button">
</td>
</tr>
</table>
</form>
<script type="text/javascript">
/* Focus on the search input */
document.getElementById('text_imdbsearch_1').focus();
document.getElementById('text_imdbsearch_1').value += '';
</script>
<p> </p>
{if $results|@count > 0}
<div>
<h2>Results from IMDb</h2>
<table width="100%">
{section name=r loop=$results}
<tr>
<td>
<div style="float: right; margin-left: 20px;">[<a href="http://www.imdb.com/title/tt{$results[r]->imdbid()}" target="_blank">IMDb</a>]</div>
<a href="./?go=add&imdbid={$results[r]->imdbid()}">
<div style="float: right">{if $results[r]->known}<strike>{/if}{$results[r]->year()}{if $results[r]->known}</strike>{/if}</div>
{if $results[r]->known}<strike>{/if}
{$results[r]->title()}
{if $results[r]->known}</strike>{/if}
</a>
</td>
</tr>
{/section}
</table>
</div>
{elseif $search != ""}
<div>
<h2>No results from IMDb</h2>
</div>
{else}
<div>
<h2>New movie</h2>
{if $movie && $movie->photo()}
<div style="float: right; margin-right: 100px;">
<img src="{$movie->photo()}" alt="{$movie->title()|trim}" title="{$movie->title()|trim}">
</div>
{/if}
{if $known}
<span class="inputerror">Warning! This movie was already added to the database!</span>
{/if}
<form name="addform" method="POST" action="./?go=add" enctype="multipart/form-data" onsubmit="if(verify(this)) return true; else alert('Some fields are not filled in correctly!'); return false;">
<table>
<tr>
<td> </td>
<td><input type="submit" name="submit" value="add" class="button"></td>
</tr>
<tr id="tr_imdbid">
<td width="150">IMDb number:</td>
<td><input type="text" name="imdbid" id="unsignedinteger_imdbid_0" value="{if $movie}{$movie->imdbid()|trim|replace:"\"":"""}{/if}" class="textfield"></td>
</tr>
<tr id="tr_name">
<td>Title: <span class="inputerror">*</span></td>
<td><input type="text" name="name" id="text_name_1" value="{if $movie}{$movie->title()|trim|replace:"\"":"""}{/if}" class="textfield"></td>
</tr>
<tr id="tr_aka">
<td>AKA titles:</td>
<td>
{if $movie}
{assign var=akas value=$movie->alsoknow()}
{/if}
<textarea name="aka" id="text_aka_0" class="textarea">{section name=a loop=$akas}{$akas[a].title|trim|replace:"\"":"""}
{/section}</textarea>
</td>
</tr>
<tr id="tr_year">
<td>Year: <span class="inputerror">*</span></td>
<td><input type="text" name="year" id="unsignedinteger_year_1" value="{if $movie}{$movie->year()|trim|replace:"\"":"""}{/if}" class="textfield"></td>
</tr>
<tr id="tr_duration">
<td>Duration (minutes):</td>
<td><input type="text" name="duration" id="unsignedinteger_duration_0" value="{if $movie}{$movie->runtime()|trim|replace:"\"":"""}{/if}" class="textfield"></td>
</tr>
<tr id="tr_rating">
<td>Rating:</td>
<td><input type="text" name="rating" id="text_rating_0" value="{if $movie}{$movie->rating()|trim|replace:"\"":"""}{/if}" class="textfield"></td>
</tr>
<tr id="tr_format">
<td>Format: <span class="inputerror">*</span></td>
<td>
<select name="format" class="select">
<option value="DVD">DVD</option>
<option value="Blu-ray">Blu-ray</option>
</select>
</td>
</tr>
<tr id="tr_own">
<td>I own this movie: <span class="inputerror">*</span></td>
<td>
<input type="radio" name="own" id="own_yes" value="1" checked><label for="own_yes">yes</label>
<input type="radio" name="own" id="own_no" value="0"><label for="own_no">no</label>
</td>
</tr>
<tr id="tr_seen">
<td>I have seen movie: <span class="inputerror">*</span></td>
<td>
<input type="radio" name="seen" id="seen_yes" value="1" checked><label for="seen_yes">yes</label>
<input type="radio" name="seen" id="seen_no" value="0"><label for="seen_no">no</label>
</td>
</tr>
<tr id="tr_loaned">
<td>Loaned out: <span class="inputerror">*</span></td>
<td>
<input type="radio" name="loaned" id="loaned_yes" value="1" onclick="doDisplay('tr_loandate', true); doDisplay('tr_loanname', true);"><label for="loaned_yes">yes</label>
<input type="radio" name="loaned" id="loaned_no" value="0" onclick="doDisplay('tr_loandate', false); doDisplay('tr_loanname', false);" checked><label for="loaned_no">no</label>
</td>
</tr>
<tr id="tr_loandate" style="display: none;">
<td>When loaned out:</td>
<td>
<input type="text" name="loandate" id="date_loandate_0" value="{$smarty.now|date_format:"%Y-%m-%d"}" class="textfield">
</td>
</tr>
<tr id="tr_loanname" style="display: none;">
<td>Loaned out to:</td>
<td>
<input type="text" name="loanname" id="text_loanname_0" value="" class="textfield">
</td>
</tr>
<tr id="tr_cover">
<td>Cover:</td>
<td>
<input type="file" name="cover" id="text_cover_0" class="textfield" size="35"><br>
[<a href="http://www.cdcovers.cc/search/dvd/{if $movie}{$movie->name|trim|replace:" ":"-"}{/if}" target="_blank">Search the cover</a>]
</td>
</tr>
<tr id="tr_notes">
<td>Personal notes:</td>
<td>
<textarea name="notes" id="text_notes_0" class="textarea"></textarea>
</td>
</tr>
<tr id="tr_taglines">
<td>Taglines:</td>
<td>
{if $movie}
{assign var=tagline value=$movie->taglines()}
{/if}
<textarea name="taglines" id="text_taglines_0" class="textarea">{section name=t loop=$tagline}{$tagline[t]|trim|replace:"\"":"""}
{/section}</textarea>
</td>
</tr>
<tr id="tr_plotoutline">
<td>Plot outline:</td>
<td><textarea name="plotoutline" id="text_plotoutline_0" class="textarea">{if $movie}{$movie->plotoutline()|trim|replace:"\"":"""}{/if}</textarea></td>
</tr>
<tr id="tr_plots">
<td>Plots:</td>
<td>
{if $movie}
{assign var=plots value=$movie->plot()}
{/if}
<textarea name="plots" id="text_plots_0" class="textarea" style="height: 100px;">{section name=p loop=$plots}{$plots[p]|trim|stripTags|replace:"\"":"""}
{/section}</textarea>
</td>
</tr>
<tr id="tr_languages">
<td>Languages:</td>
<td>
{if $movie}
{assign var=languages value=$movie->languages()}
{/if}
<textarea name="languages" id="text_languages_0" class="textarea">{section name=l loop=$languages}{$languages[l]|trim|replace:"\"":"""}
{/section}</textarea>
</td>
</tr>
<tr id="tr_country">
<td>Country:</td>
<td>
{if $movie}
{assign var=country value=$movie->country()}
{/if}
<textarea name="country" id="text_country_0" class="textarea">{section name=c loop=$country}{$country[c]|trim|replace:"\"":"""}
{/section}</textarea>
</td>
</tr>
<tr id="tr_genres">
<td>Genres:</td>
<td>
{if $movie}
{assign var=genres value=$movie->genres()}
{/if}
<textarea name="genres" id="text_genres_0" class="textarea">{section name=g loop=$genres}{$genres[g]|trim|replace:"\"":"""}
{/section}</textarea>
</td>
</tr>
<tr id="tr_director">
<td>Director:</td>
<td>
{if $movie}
{assign var=director value=$movie->director()}
{/if}
<textarea name="director" id="text_director_0" class="textarea">{section name=d loop=$director}{$director[d].name|trim|replace:"\"":"""}
{/section}</textarea>
</td>
</tr>
<tr id="tr_writer">
<td>Writer:</td>
<td>
{if $movie}
{assign var=writer value=$movie->writing()}
{/if}
<textarea name="writer" id="text_writer_0" class="textarea">{section name=w loop=$writer}{$writer[w].name|trim|replace:"\"":"""}
{/section}</textarea>
</td>
</tr>
<tr id="tr_producer">
<td>Producer:</td>
<td>
{if $movie}
{assign var=writer value=$movie->producer()}
{/if}
<textarea name="producer" id="text_producer_0" class="textarea">{section name=p loop=$producer}{$producer[p].name|trim|replace:"\"":"""}
{/section}</textarea>
</td>
</tr>
<tr id="tr_music">
<td>Music:</td>
<td>
{if $movie}
{assign var=writer value=$movie->composer()}
{/if}
<textarea name="music" id="text_music_0" class="textarea">{section name=m loop=$music}{$music[m].name|trim|replace:"\"":"""}
{/section}</textarea>
</td>
</tr>
<tr id="tr_cast">
<td>Cast:</td>
<td>
{if $movie}
{assign var=cast value=$movie->cast()}
{/if}
<textarea name="cast" id="text_cast_0" class="textarea" style="height: 80px;">{section name=c loop=$cast}{$cast[c].name|trim|replace:"\"":"""}
{/section}</textarea>
</td>
</tr>
<tr>
<td>
{if $movie}
<input type="hidden" name="image" value="{$movie->photo()|trim}">
{/if}
<input type="hidden" name="add" value="0">
</td>
<td><input type="submit" name="submit" value="add" class="button"></td>
</tr>
</table>
</form>
</div>
{/if}