{*
  Template for the edit interface
  $Id: edit_competitions.tpl,v 1.00 2006/10/26 20:00:00
*}

<!-- {$smarty.template} -->
<div id="toppage">{if $competition.id}<a href="show_competitions.php?id={$competition.id}">{$competition.q_longname}</a>{else}<a href="#">{$lang.newcompetition}</a>{/if}</div>
{if $competition.id}
<div id="actions">
<table id="tableshow" width="100%" cellpadding="2" cellspacing="0" border="0">
	<tr>
		<td>
			{if $administrable}
			<form action="edit_competitions.php" name="editform">
					<span class="onglet-admin">
					<input type="submit" value="{$lang.newdata}" />
					</span>
			</form>
			<form action="edit_competitions.php" name="editform">
					<input type="hidden" name="id" value="{$competition.id}"/>
					<span class="onglet-admin">
					<input type="submit" value="{$lang.edit}" />
					</span>
			</form>
			<form action="delete.php" name="deleteform">
					<input type="hidden" name="id" value="{$competition.id}"/>
					<input type="hidden" name="cat" value="3"/>
					<span class="onglet-admin">
					<input type="submit" value="{$lang.del}" onclick="return(confirm('{$competition.lastname|escape:javascript}: {$lang.really_del}?'))" />
					</span>
			</form>
			{/if}
			{if $editable || $administrable}
			<form action="edit_candidates.php" name="candidateform">
					<input type="hidden" name="competition" value="{$competition.id}"/>
					<input type="hidden" name="season" value="{$season}"/>				
					<span class="onglet-admin">
					<input type="submit" value="{$lang.editseason}" />
					</span>
			</form>
			<form action="edit_penalitys.php" name="penalityform">
					<input type="hidden" name="competition" value="{$competition.id}"/>
					<input type="hidden" name="season" value="{$season}"/>				
					<span class="onglet-admin">
					<input type="submit" value="{$lang.editpenality}" />
					</span>
			</form>
			<form action="edit_days.php" name="dayform">
					<input type="hidden" name="competition" value="{$competition.id}"/>
					<input type="hidden" name="season" value="{$season}"/>				
					<span class="onglet-admin">
					<input type="submit" value="{$lang.editday}" />
					</span>
			</form>
			<form action="edit_matchs.php" name="matchsform">
					<input type="hidden" name="competition" value="{$competition.id}"/>
					<input type="hidden" name="season" value="{$season}"/>				
					<span class="onglet-admin">
					<input type="submit" value="{$lang.editmatchs}" />
					</span>
			</form>
			<form action="edit_goals.php" name="matchsform">
					<input type="hidden" name="competition" value="{$competition.id}"/>
					<input type="hidden" name="season" value="{$season}"/>				
					<span class="onglet-admin">
					<input type="submit" value="{$lang.editgoals}" />
					</span>
			</form>
			{/if}
		</td>
	</tr>
	<tr>
		<td>
	
		{if $competition.id}
			<form action="show_competitions.php" method="get" name="show">
				<input type="hidden" name="id" value="{$competition.id}" />
				<span class="onglet">
				<input type="submit"  value="{$lang.card}" />
				</span>
			</form>
			{if $season}
			<form action="show_matchs.php" name="calendarform">
					<input type="hidden" name="competition" value="{$competition.id}"/>
					<input type="hidden" name="season" value="{$season}"/>
					<span class="onglet">
					<input type="submit"  value="{$lang.calendar}" {if !$competition}disabled="disabled"{/if} />
					</span>
			</form>
				{if $statsactive}
				<form action="stats_competitions.php" name="statsform">
						<input type="hidden" name="id" value="{$competition.id}"/>
						<input type="hidden" name="season" value="{$season}"/>
						<span class="onglet">
						<input type="submit" value="{$lang.stats}" {if !$competition.id} disabled="disabled"{/if} />
						</span>
				</form>
				{/if}
			<form action="show_kickers.php" name="tableform">
				<input type="hidden" name="competition" value="{$competition.id}"/>
				<input type="hidden" name="season" value="{$season}"/>
				<span class="onglet">
				<input type="submit" value="{$lang.kickers}"{if !$competition.id} disabled="disabled"{/if} />
				</span>
			</form>
			<form action="show_cards.php" name="tableform">
				<input type="hidden" name="competition" value="{$competition.id}"/>
				<input type="hidden" name="season" value="{$season}"/>
				<span class="onglet">
				<input type="submit" value="{$lang.cards}"{if !$competition.id} disabled="disabled"{/if} />
				</span>
			</form>
			{/if}
		{/if}
		{if $seegallery}
			<form action="gallery.php" name="galleryform">
				<input type="hidden" name="subcat" value="{$competition.id}"/>
				<input type="hidden" name="cat" value="2" />
				<span class="onglet">
				<input type="submit" value="{$lang.gallery}" />
					</span>
			</form>
		{/if}
		{if $commentable}
				<form action="comments.php" name="mkcommentform">
					<input type="hidden" name="subcat" value="{$competition.id}"/>
					<input type="hidden" name="cat" value="2" />
					<span class="onglet">
					<input type="submit" value="{$lang.comment}" />
					</span>
				</form>
		{/if}
		{if $prev_id || $next_id}
				<form action="edit_competitions.php" name="prevform">
					<input type="hidden" name="id" value="{$prev_id}"/>
					<span class="onglet">
					<input type="submit"  value="<" {if !$prev_id}disabled="disabled"{/if} accesskey="," />
					</span>
				</form>
				<form action="edit_competitions.php" name="nextform">
					<input type="hidden" name="id" value="{$next_id}"/>
					<span class="onglet">
					<input type="submit"  value=">" {if !$next_id}disabled="disabled"{/if} accesskey="." />
					</span>
				</form>
		{/if}
		
		</td>
	</tr>
</table>
		<!-- /actions -->
		
</div>	 
	{/if}


<script language="JavaScript" type="text/javascript" src="javascript/edit.js"></script>


{if $http_error}<div class="center">{$http_error}</div>{/if}
<form action="edit_competitions.php" id="edi" name="edi" method="post" enctype="multipart/form-data">
  <input type="hidden" name="id" id="id" value="{$competition.id}" />
  <input type="hidden" name="save" id="save" value="1" />
<div id="pagecontent">
<table id="tableshow" width="100%" cellpadding="2" cellspacing="0" border="0">
	<tr>
		<td class="lineeven"><b>» {$lang.longname} :</b></td>
		<td class="lineeven">
		<input type="text" style="width:95%;" name="longname" id="longname" value="{$competition.q_longname}"  size="40" maxlength="255" />
		</td>
	</tr>
	<tr>
		<td class="lineodd"><b>» {$lang.shortname} :</b></td>
		<td class="lineodd">
		<input type="text" style="width:95%;" name="shortname" id="shortname" value="{$competition.q_shortname}"  size="40" maxlength="255" />
		</td>
	</tr>		
	<tr>
		<td class="lineeven"><b>» {$lang.aka} :</b></td>
		<td class="lineeven">
		<input type="text" style="width:95%;" name="aka" id="aka" value="{$competition.q_aka}"  size="40" maxlength="255" />
		</td>
	</tr>
	<tr>
		<td class="lineodd"><b>» {$lang.category} :</b></td>
		<td class="lineodd">
		<select style="width:95%;" name="category">
			<option value="0">---{$lang.category}---</option>
			{foreach item=categorie from=$categoryselect}
			<option value="{$categorie.id}" {if $categorie.id == $competition.q_category}Selected{/if}>{$categorie.longname}</option>
			{/foreach}
		</select>
		</td>
	</tr>
	<tr>
		<td class="lineodd"><b>» {$lang.subcompet} :</b></td>
		<td class="lineodd">
		<select style="width:95%;" name="subcompet">
			<option value="0">---{$lang.subcompet}---</option>
			{foreach item=subcompet from=$subcompetselect}
			<option value="{$subcompet.id}" {if $subcompet.id == $competition.q_subcompet}Selected{/if}>{$subcompet.longname}</option>
			{/foreach}
		</select>
		</td>
	</tr>
	<tr>
		<td class="lineodd"><b>» {$lang.country} :</b></td>
		<td class="lineodd">
		<select name="country">
			<option value="0">---{$lang.country}---</option>
			{foreach item=country from=$countryselect}
			<option value="{$country.id}" {if $country.id == $competition.q_country}Selected{/if}>{$country.val}</option>
			{/foreach}
		</select>
		</td>
	</tr>
	<tr>
		<td class="lineeven"  style="vertical-align:middle;" valign="top">
			<b>» {$lang.active}:<input type="checkbox" name="active" value="1"{if $competition.q_active} checked{/if}></b>
			
		</td>
        <td style="vertical-align:middle;" class="lineeven">
			<b>» {$lang.visible}:<input type="checkbox" name="visible" value="1"{if $competition.q_visible} checked{/if}> </b><br>
			<b>» {$lang.competinoneyear}:<input type="checkbox" name="oneyear" value="1"{if $competition.q_oneyear} checked{/if}> </b>
		</td>
    </tr>
    <tr>
    	<td class="lineodd"><b>» {$lang.creation} :</b></td>
        <td class="lineodd"><input type="text" name="creation" id="creation" value="{$competition.q_creation}" size="8" maxlength="4" />  (YYYY)</td>
    </tr>
	<tr>
    	<td class="lineodd"><b>» {$lang.cessation} :</b></td>
        <td class="lineodd"><input type="text" name="complete" id="complete" value="{$competition.q_complete}" size="8" maxlength="4" />  (YYYY)</td>
    </tr>
	<tr>
    	<td class="lineeven"><b>» {$lang.website} :</b></td>
        <td class="lineeven"><input type="text" style="width:95%;" name="website" id="website" value="{$competition.q_website}" size="25" maxlength="255" /></td>
    </tr>
	<tr>
    	<td class="lineodd"><b>» {$lang.logourl} :</b></td>
        <td class="lineodd"> 
        <input type="text" style="width:95%;" name="imgurl" id="imgurl" value="{$competition.q_imgurl}"  size="40" maxlength="255" />
        </td>
    </tr>		
    <tr>
    <td class="lineeven"><b>» {$lang.logoupload} :</b></td>
    <td class="lineeven"><input type="file" name="coverupload" id="coverupload" size="35" /></td>
    </tr>
    <tr>
    	<td class="lineodd"><b>» {$lang.comments} :</b></td>
        <td class="lineodd"><textarea style="width:95%; height:100px;" name="plot" id="plot" wrap="virtual">{$competition.q_plot}</textarea></td>
    </tr>
	<tr>
	<td class="lineeven" colspan="2">
		<table width="100%" cellpadding="2" cellspacing="1" border="0">
		<tr>
		  <td rowspan="2"><h4>{$lang.type} :</h4></td>
          <td>
		  {counter start=0 print=false name=rangecount}
		  {foreach item=range from=$competrange}
		  {counter assign=count name=rangecount}
		  <label for="range{$count}"><input type="radio" name="range" id="range{$count}" value="{$count}"{if $competition.q_range == $count} checked="checked"{/if}/>{if !$count}{$competrange[0]}{else}{$competrange[$count]}{/if}</label>
		  
		  {/foreach}
		  </td>
        </tr>
		<tr>
		   <td>
		  {counter start=1 print=false assign=count2 name=compettype}
		  {foreach item=country from=$compettype}
		  <label for="type{$count2}"><input type="radio" name="type" id="type{$count2}" value="{$count2}"{if $competition.q_type == $count2} checked="checked"{/if}/>{if !$count2}{$compettype[0]}{else}{$compettype[$count2]}{/if}</label>
		  {counter assign=count2 name=compettype}
		  {/foreach}
		  </td>
        </tr>
      </table>
	</td>
	</tr>

	{foreach from=$competition.carac_ads item=option}
	<tr>
	  <td class="lineodd"><b>{$option.name}:</b></td>
	  <td class="lineodd">
		{if $option.genre == 1}
			<input type="text" style="width:95%;" size="45" name="{$option.lib_key}" id="{$option.key_lib}" value="{$option.value}" class="center" />
	 	{/if}
		{if $option.genre == 2}
			<input type="text" size="8" name="{$option.lib_key}" id="{$option.key_lib}" value="{$option.value}" class="center" />
		{/if}
		{if $option.genre == 3}
			<input type="text" style="width:95%;" size="45" name="{$option.lib_key}" id="{$option.key_lib}" value="{$option.value}" class="center" />
		{/if}
		{if $option.genre == 4}
			<input type="text" size="15" name="{$option.lib_key}" id="{$option.key_lib}" value="{$option.value}" class="center" />
		{/if}
		{if $option.genre == 5}
			<textarea cols="40" rows="4" name="{$option.lib_key}" id="{$option.key_lib}" wrap="virtual">{$option.value}</textarea>
		{/if}
		{if $option.genre == 6}
            {html_checkbox name=$option.key_lib id=$option.lib_key value=1 checked=$option.set}
        {/if}
		{if $option.genre == 7}	
			<input type="file" name="{$option.lib_key}" id="{$option.lib_key}" size="35" />
		{/if}
	  </td>
	</tr>
	{/foreach}
	 <tr>
		<td width="50%" align="center"><span class="onglet"><input style="width:100%;" type="submit" value="{$lang.save}" id="savebutton" accesskey="s" /></span></td>
		<td width="50%" align="center"><span class="onglet"><input style="width:100%;" type="button" value="{$lang.back}" id="backbutton" onclick="javascript:history.go(-1);" accesskey="b" /></span></td>
		</tr>
	</table>
	</form>
	<br />
	{if $administrable}
	<form action="edit_competitions.php" id="ediadm" name="ediadm" method="post" onSubmit="javascript:return CheckAlbumForm(this,'{$lang.wanttochange}','{$lang.mustbe2}',1);">
    <input type="hidden" name="id" id="id" value="{$competition.id}" />
    <input type="hidden" name="ownersave" id="ownersave" value="1" />
	<table id="tableshow" width="100%" cellpadding="2" cellspacing="0" border="0">
	  <tr>
		<td colspan="3" id="toppage"><a href="#">{$lang.defineadmins}</a></td>
	  <tr>
		<td width="40%"><h3>{$lang.members}:</h3></td>
		<td>&nbsp;</td>
		<td width="40%"><h3>{$lang.admins}:</h3></td>
	  </tr>
	  <tr>
		  <td class="td-value" align="right">
			  <select size="10" style="width:150px; font-size:12px;" name="members" ondblclick="affecte(this.form.candidate,this.form.members); this.form.numowners.value = this.form.candidate.options.length + ' {$lang.admins}';">
				{foreach item=member from=$members}
				<option value="{$member.id}">{$member.name}</option>
				{/foreach}
			  </select>			  
		  </td>	  
		  <td class="td-opt" valign="middle" align="center"><br /><br /><br /><br />  
		  <span id="numcandidates">
		  <input type="text" name="numowners" value="0 {$lang.admins}" size="6" style="border:0px; width:150px; text-align:center; font-size:14px; font-weight:600;">
		  </span>
		  <span class="onglet">
		  <input type="button" onclick="affectetout(this.form.candidate,this.form.members);  this.form.numowners.value = this.form.candidate.options.length + ' {$lang.admins}';" value="{$lang.add} &raquo;"><br /><br />
		  </span>
		  <span class="onglet">
			<input type="button" onclick="affectetout(this.form.members,this.form.candidate);  this.form.numowners.value = this.form.candidate.options.length + ' {$lang.admins}';" value="&laquo; {$lang.del}">
		  </span>
		  </td>
		  <td class="td-value" align="left">
			  <select size="10" style="width:150px; font-size:12px;" id="candidate" name="candidate[]" multiple="yes" ondblclick="affecte(this.form.members,this.form.candidate);  this.form.numowners.value = this.form.candidate.options.length + ' {$lang.admins}';">
				{foreach item=candidate from=$owners}
				<option value='{$candidate.id}'>{$candidate.name}</option>
				{/foreach}
			  </select>
		  </td>   
	   </tr>
	   <tr>
			<td width="40%"><span class="onglet"><input style="width:100%;" type="submit" value="{$lang.save}" id="savebutton" accesskey="s" /></span></td>
			<td>&nbsp;</td>
			<td width="40%"><span class="onglet"><input style="width:100%;" type="button" value="{$lang.back}" id="backbutton" onclick="javascript:history.go(-1);" accesskey="b" /></span></td>
		</tr>
	</table>
	</form>
   {/if}		


<script language="JavaScript" type="text/javascript">
	document.ediadm.numowners.value = document.ediadm.candidate.options.length + ' {$lang.admins}';
	document.edi.longname.focus();
</script>


</div>
<!-- /content -->
