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

<!-- {$smarty.template} -->
<div id="actions">

<table id="tableshow" border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td id="toppage">{if $club.id}<a href="show_clubs.php?id=$club.id">{$club.q_longname}</a>{else}{$lang.newclub}{/if}</td>
	</tr>
{if $club.id}
	{if $editable || $administrable}
	<tr>
		<td>
		{if $administrable}
		<form action="edit_clubs.php" name="editform">
				<span class="onglet-admin">
				<input type="submit" value="{$lang.newdata}" />
				</span>
		</form>
		{/if}
		{if $editable || $administrable}
		<form action="edit_clubs.php" name="editform">
				<input type="hidden" name="id" value="{$club.id}"/>
				<span class="onglet-admin">
				<input type="submit" value="{$lang.edit}" />
				</span>
		</form>
		{/if}
		{if $administrable}
		<form action="delete.php" name="deleteform">
				<input type="hidden" name="id" value="{$club.id}"/>
				<input type="hidden" name="cat" value="1"/>
				<span class="onglet-admin">
				<input type="submit" value="{$lang.del}" onclick="return(confirm('{$club.shorttname|escape:javascript}: {$lang.msg_really_del}?'))" />
				</span>
		</form>
		{/if}
		{if $editable || $administrable}
		<form action="edit_teams.php" name="matchsform">
				<input type="hidden" name="id" value="{$club.id}"/>
				<input type="hidden" name="season" value="{$season}"/>				
				<span class="onglet-admin">
				<input type="submit" value="{$lang.editteams}" />
				</span>
		</form>
		{/if}
		</td>
	</tr>
	{/if}
	<tr>
		<td>
		<form action="show_clubs.php" method="get" name="show">
			<input type="hidden" name="id" value="{$club.id}" />
			<span class="onglet">
			<input type="submit"  value="{$lang.view}" />
			</span>
		</form>
		<form action="show_teams.php" name="editform">
				<input type="hidden" name="id" value="{$club.id}"/>
				<span class="onglet">
				<input type="submit"  value="{$lang.teamplayers}" />
				</span>
		</form>
		<form action="show_calendarteams.php" name="editform">
				<input type="hidden" name="id" value="{$club.id}"/>
				<span class="onglet">
				<input type="submit"  value="{$lang.calendar}" />
				</span>
		</form>
		{if $clubstats}
			<form action="stats_clubs.php" name="editform">
					<input type="hidden" name="id" value="{$club.id}"/>
					<span class="onglet">
					<input type="submit" value="{$lang.statistics}" />
					</span>
			</form>
		{/if}
		{if $club.seegallery}
			<form action="gallery.php" name="galleryform">
				<input type="hidden" name="subcat" value="{$club.id}"/>
				<input type="hidden" name="cat" value="1" />
				<span class="onglet">
				<input type="submit" value="{$lang.gallery}" />
				</span>
			</form>
		{/if}
		{if $club.commentable}
				<form action="comments.php" name="mkcommentform">
					<input type="hidden" name="subcat" value="{$club.id}"/>
					<input type="hidden" name="cat" value="1" />
					<span class="onglet">
					<input type="submit" value="{$lang.comment}" />
					</span>
				</form>
		{/if}
		{if $club.prev_id || $club.next_id}
				<form action="show_clubs.php" name="prevform">
					<input type="hidden" name="id" value="{$club.prev_id}"/>
					<span class="onglet">
					<input type="submit"  value="<" {if !$club.prev_id}disabled="disabled"{/if} accesskey="," />
					</span>
				</form>
				<form action="show_clubs.php" name="nextform">
					<input type="hidden" name="id" value="{$club.next_id}"/>
					<span class="onglet">
					<input type="submit"  value=">" {if !$club.next_id}disabled="disabled"{/if} accesskey="." />
					</span>
				</form>
		{/if}
		</td>
	</tr>
	
{/if}
</table>
</div>

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


{if $http_error}<div class="center">{$http_error}</div>{/if}


<form action="edit_clubs.php" id="edi" name="edi" method="post" enctype="multipart/form-data">
<input type="hidden" name="id" id="id" value="{$club.id}" />
<input type="hidden" name="save" id="save" value="1" />

<table id="tableshow" width="100%" cellspacing="0" cellpadding="1" border="0">
  	<tr>
      	<td class="lineeven"><b>» {$lang.name} :</b></td>
      	<td class="lineeven">
      	<input type="text" name="shortname" id="shortname" value="{$club.q_shortname}"  size="40" maxlength="255" />
      	</td>
  	</tr>
	<tr>
    	<td class="lineodd"><b>» {$lang.longname} :</b></td>
        <td class="lineodd">
        <input type="text" name="longname" id="longname" value="{$club.q_longname}"  size="40" maxlength="255" />
        </td>
    </tr>
	<tr>
    	<td class="lineeven"><b>» {$lang.city} :</b></td>
    	<td class="lineeven">
        <input type="text" name="city" id="city" value="{$club.q_city}"  size="40" maxlength="255" />
        </td>
    </tr>
	<tr>
    	<td class="lineodd"><b>» {$lang.aka} :</b></td>
        <td class="lineodd">
        <input type="text" name="aka" id="longname" value="{$club.q_aka}"  size="40" maxlength="255" />
        </td>
	</tr>
	<tr>
    	<td class="lineeven"><b>» {$lang.nationalteam} :</b></td>
        <td class="lineeven">
        <input type="checkbox" name="nationalteam" id="nationalteam" value="1"{if $club.q_nationalteam}checked{/if} />
        </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 == $club.q_country}Selected{/if}>{$country.val}</option>
		{/foreach}
		</select>
        </td>
    </tr>
    <tr>
        <td class="lineeven"><b>» {$lang.creation} :</b></td>
        <td class="lineeven"><input type="text" name="creation" id="creation" value="{$club.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="{$club.q_complete}" size="8" maxlength="4" />  (YYYY)</td>
	</tr>
	<tr>
		<td class="lineeven"><b>» {$lang.president} :</b></td>
        <td class="lineeven">	
		<select name="id_president">
		<option value="0">---{$lang.president}---</option>
		{foreach item=president from=$presidentselect}
		<option value="{$president.id}" {if $president.id == $club.q_id_president}Selected{/if}>{$president.lastname} {$president.firstname}</option>
		{/foreach}
		</select>
		</td>
	</tr>
	<tr>
        <td class="lineodd"><b>» {$lang.officialwebsite} :</b></td>
        <td class="lineodd"><input type="text" name="website" id="website" value="{$club.q_website}" size="25" maxlength="255" /></td>
    </tr>
	<tr>
    	<td class="lineeven"><b>» {$lang.email} :</b></td>
        <td class="lineeven"><input type="text" name="email" id="email" value="{$club.q_email}" size="25" maxlength="255" /></td>
	</tr>
	<tr>
    	<td class="lineodd"><b>» {$lang.tel} :</b></td>
        <td class="lineodd"><input type="text" name="tel" id="tel" value="{$club.q_tel}" size="25" maxlength="255" /></td>
	</tr>
	<tr>
    	<td class="lineeven"><b>» {$lang.fax} :</b></td>
        <td class="lineeven"><input type="fax" name="fax" id="fax" value="{$club.q_fax}" size="25" maxlength="255" /></td>
	</tr>
	<tr>
		<td class="lineodd"><b>» {$lang.stadium} :</b></td>
        <td class="lineodd">	
		<select name="id_stadium">
		<option value="0">---{$lang.stadium}---</option>
		{foreach item=stadium from=$stadiumselect}
		<option value="{$stadium.id}" {if $stadium.id == $club.q_id_stadium}Selected{/if}>{$stadium.longname}</option>
		{/foreach}
		</select>
		</td>
	</tr>		
    <tr>
    	<td class="lineeven"><b>» {$lang.logourl} :</b></td>
        <td class="lineeven">
        <input type="text" name="imgurl" id="imgurl" value="{$club.q_imgurl}"  size="40" maxlength="255" />
        </td>
	</tr>		
    <tr>
    	<td class="lineodd"><b>» {$lang.logoupload} :</b></td>
        <td class="lineodd"><input type="file" name="coverupload" id="coverupload" size="35" /></td>
	</tr>

	{counter start=0 print=false name=optcount}
	{foreach from=$club.carac_ads item=option}
	{counter assign=count name=optcount}
	<tr>
	  <td class="lineodd"><b>» {$option.name}:</b></td>
	  <td class="lineodd">
		{if $option.genre == 1}
			<input type="text" size="20" 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" 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 class="lineeven" colspan="2"><b>» {$lang.adresse} :</b></td>
	</tr>
    <tr>
        <td class="lineeven" colspan="2"><textarea style="width:95%; height:100px;" name="adresse" id="adresse" wrap="virtual">{$club.q_adresse}</textarea></td>
	</tr>		
  	<tr>
    	<td class="lineeven" colspan="2"><b>» {$lang.comments} :</b></td>
	</tr>
    <tr>
        <td class="lineeven" colspan="2"><textarea style="width:95%; height:150px;" name="plot" id="plot" wrap="virtual">{$club.q_plot}</textarea></td>
    </tr>
	<tr>
		<td colspan="2">	
			<span class="onglet">
			  <input style="width:100%;" type="submit" value="{$lang.save}" id="savebutton" accesskey="s" />
			</span>
			<span class="onglet">
			  <input style="width:100%;" type="button" value="{$lang.back}" id="backbutton" accesskey="b" onclick="javascript:history.go(-1);"/>
			</span>
		</td>
	</tr> 
  </table>
</form>

	<br />
	{if $administrable}
	<form action="edit_clubs.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="{$club.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.shortname.focus();
</script>


