
<script type="text/javascript"> 
<!-- //
{include file="$incpath/other/validate_js.tpl"}
{literal}
$().ready(function() {
	$("#new").validate(
	{ // validate
	rules: {
				DownloadBis: {required: true}
			},
	messages: {},
	submitHandler: function() { document.forms['new'].submit();}
	});
}
);


$().ready(function() {
	$("#save").validate(
	{ // validate
	rules: {
				{/literal}
				{foreach from=$userfiles item=uf name=ufi}
				'DownloadBis[{$uf->Id}]': {ldelim}required: true{rdelim}
				{if !$smarty.foreach.ufi.last},{/if}
				{/foreach}
				{literal}
			},
	messages: {
		{/literal}
		{foreach from=$userfiles item=uf name=ufi}
		'DownloadBis[{$uf->Id}]':{ldelim}required:''{rdelim}
		{if !$smarty.foreach.ufi.last},{/if}
		{/foreach}
		{literal}
		},
	submitHandler: function() { document.forms['save'].submit();}
	});
}
);
// -->
</script>
{/literal}
<div class="popbox">
{if $userfiles}
  <div class="header">{#Shop_downloads_for#} {$smarty.request.name|koobispecialchars}</div>
  <form method="post" action="index.php?do=shop&sub=user_downloads&save=1&user={$smarty.request.user}&noframes=1" id="save" name="save">
    <table width="100%"  border="0" cellpadding="2" cellspacing="0" class="tableborder">
      <tr>
        <td class="headers">{#Shop_downloads_product#}</td>
        <td align="center" class="headers">{#Shop_downloads_dltill#}</td>
        <td align="center" class="headers">{#Shop_downloads_lic#}</td>
        <td align="center" class="headers">{#Shop_downloads_urli#}</td>
        <td align="center" class="headers">{#Shop_downloads_acomment#}</td>
        <td align="center" class="headers">{#Shop_downloads_ucomment#}</td>
        <td align="center" class="headers">&nbsp;</td>
      </tr>
      {foreach from=$userfiles item=uf}
      <tr>
        <td class="subheaders" style="padding:6px" colspan="7"><h3>{$uf->article|koobispecialchars}</h3></td>
      </tr>
      <tr class="{cycle name='ufi' values='second,first'}">
        <td valign="top" class="row_spacer">
        <input type="hidden" name="Userfile[{$uf->Id}]" value="{$uf->Id}"/>
        
       {#Shop_downloads_flocked#} 
        <label><input type="radio" name="Gesperrt[{$uf->Id}]" value="1" {if $uf->Gesperrt==1}checked{/if}>{#Yes#}</label>
        <label><input type="radio" name="Gesperrt[{$uf->Id}]" value="0" {if $uf->Gesperrt!=1}checked{/if}>{#No#}</label>
        
        <div style="margin-top:8px">
         
        <input style="width:180px" class="input" name="GesperrtGrund[{$uf->Id}]" type="text" value="{$uf->GesperrtGrund|koobispecialchars|default:$config_vars.Shop_downloads_deflocked}">
        </div>
        
        </td>
        <td align="center" valign="top" class="row_spacer">
          <input style="width:60px" class="input" name="DownloadBis[{$uf->Id}]" type="text" id="DownloadBis_{$uf->Id}" value="{$uf->DownloadBis|date_format:'%d.%m.%Y'}" readonly="readonly">        </td>
        <td align="center" valign="top" class="row_spacer">
          <input style="width:110px" class="input" name="Lizenz[{$uf->Id}]" type="text" id="Lizenz[{$uf->Id}]" value="{$uf->Lizenz}" readonly="readonly">          </td>
        <td align="center" valign="top" class="row_spacer">
          <input class="input" name="UrlLizenz[{$uf->Id}]" type="text" id="url_{$uf->Id}" value="{$uf->UrlLizenz}">      
          <br />
          {#Shop_downloads_fmust#} 
          <label><input type="radio" name="UrlLizenz_Pflicht[{$uf->Id}]" value="1" {if $uf->UrlLizenz_Pflicht==1}checked{/if}>{#Yes#}</label>
          <label><input type="radio" name="UrlLizenz_Pflicht[{$uf->Id}]" value="0" {if $uf->UrlLizenz_Pflicht!=1}checked{/if}>{#No#}</label>
        </td>
        <td align="center" class="row_spacer">
          <textarea class="input" name="KommentarAdmin[{$uf->Id}]" id="comment_admin[{$uf->Id}]">{$uf->KommentarAdmin|koobispecialchars}</textarea>          </td>
        <td align="center" class="row_spacer">
          <textarea class="input" name="KommentarBenutzer[{$uf->Id}]" id="comment_user[{$uf->Id}]">{$uf->KommentarBenutzer|koobispecialchars}</textarea>          </td>
        <td class="row_spacer">          
        <input name="del[{$uf->Id}]" type="checkbox" id="del[{$uf->Id}]" value="1" />        </td>
      </tr>
      
      {/foreach}
     </table>
     <input type="submit" class="button big" value="{#Save#}" />
     <input name="save" type="hidden"  value="1" />
     <input name="name" type="hidden" id="name" value="{$smarty.request.name|koobispecialchars}">
  </form>
  
  <br />
 {/if}
  <form method="post" action="index.php?do=shop&sub=user_downloads&newfile=1&user={$smarty.request.user}&noframes=1" id="new" name="new">
    <table width="100%"  border="0" cellpadding="3" cellspacing="0" class="tableborder">
      <tr>
        <td colspan="2" class="header">{#Shop_downloads_newufi#}</td>
      </tr>
      <tr>
        <td width="20%" class="row_left">{#Shop_downloads_product#}</td>
        <td class="row_right">
        <select class="input" name="ArtikelId">
         {foreach from=$produkte item=files}
		 <option value="{$files->Id}||{$files->Titel_1}">{$files->Titel_1}</option>
         {/foreach}
        </select>
        </td>
      </tr>
      <tr>
        <td width="20%" class="row_left">{#Shop_downloads_dltill#}</td>
        <td class="row_right">
       <input class="input" readonly="readonly" type="text" name="DownloadBis" id="dlbis" value="">
        </td>
        </tr>
      
      <tr>
        <td colspan="2" class="thirdrow">
        <input type="submit" class="button big" value="{#Save#}" />
          <input name="Lizenz" type="hidden"  value="{$lizenz}" />
          <input name="newfile" type="hidden"  value="1" />
          <input name="name" type="hidden" id="name" value="{$smarty.request.name|koobispecialchars}"></td>
      </tr>
    </table>
  </form>
  
  <p>&nbsp;</p>
<hr noshade="noshade" size="1">
<p align="center">
<input type="button" onclick="window.close();" class="button" value="{#Close#}">
</p>

</div>



<script language="javascript" src="{$jspath}/calendar.js" type="text/javascript"></script>
<style type="text/css" media="screen,projection">
@import url({$csspath}/calendar.css);
</style>
<script type="text/javascript">
	jQuery(function($){ldelim}
	$.datepicker.setDefaults({ldelim}
	{include file="$incpath/other/calendar.conf.tpl"}
	{rdelim}); 
	$("#dlbis").attachDatepicker();
	{foreach from=$userfiles item=uf}
	$("#DownloadBis_{$uf->Id}").attachDatepicker();
	{/foreach}
	{rdelim});
</script>


