<script language="javascript">
<!--
function checkmulti()
{ldelim}
	if(document.getElementById('deltrue').selected==true) 
	{ldelim}
		if(confirm('{#User_multiaction_delc#}'))
			return true;
		else
			return false;
	{rdelim} 
	
	if(document.getElementById('sendmessage').selected==true &&  document.getElementById('message_subject').value=='') 
	{ldelim}
		alert('{#User_multiaction_message_ns#}');
		document.getElementById('message_subject').focus();
		return false;
	{rdelim} 
	
	if(document.getElementById('sendmessage').selected==true &&  document.getElementById('message_text').value=='') 
	{ldelim}
		alert('{#User_multiaction_message_nt#}');
		document.getElementById('message_text').focus();
		return false;
	{rdelim} 
	
	if(document.getElementById('changegroup').selected==true && document.getElementById('changegroup_sel').selectedIndex=='0')
	{ldelim}
		alert('{#User_multiaction_group_no#}');
		document.getElementById('changegroup_sel').focus();
		return false;
	{rdelim} 
	
{rdelim} 

function getformelem()
{ldelim}
	if(document.getElementById('changegroup').selected==true) 
	{ldelim}
		document.getElementById('changegroup_sel').style.display='';
		document.getElementById('sendmessage_elems').style.display='none';
	{rdelim}
	else if(document.getElementById('sendmessage').selected==true)
	{ldelim}
		document.getElementById('sendmessage_elems').style.display='';
		document.getElementById('changegroup_sel').style.display='none';
	{rdelim}
	else
	{ldelim}
		document.getElementById('changegroup_sel').style.display='none';
		document.getElementById('sendmessage_elems').style.display='none';
	{rdelim}
{rdelim}
-->
</script>

<div class="subheaders">
<form method="post" action="index.php?do=user&sub=showusers" {if $smarty.session.UserSearch}onsubmit="return checkmulti();"{/if}>
<table border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td width="110"><label for="name">{#User_search_sw#}</label></td>
    <td width="150"><input style="width:120px" class="input"  type="text" name="name" id="name" value="{$smarty.request.name}" /></td>
    <td align="right"><label for="group">{#User_ugroup#}</label></td>
    <td>
    <select style="width:124px" class="input" name="group" id="group">
      <option value="">Alle Gruppen</option>
      
    {foreach from=$groups item=g}
    {if $g->Id!=2}
      <option value="{$g->Id}" {if $g->Id==$smarty.request.group}selected="selected"{/if}>{$g->Name_Intern|koobispecialchars}</option>
      {/if}
    {/foreach}
 
    </select></td>
  </tr>
  <tr>
    <td width="110"><label for="reg_from">{#User_search_rfrom#}</label></td>
    <td><input class="input" style="width:100px" readonly="readonly" type="text" name="regfrom" id="reg_from" value="{$smarty.request.regfrom|koobispecialchars}" /></td>
    <td align="right">{#User_search_rtill#}</td>
    <td><input class="input" style="width:100px" readonly="readonly" type="text" name="regtill" id="reg_to" value="{$smarty.request.regtill|koobispecialchars}" />
      <input type="hidden" name="page" value="1" />
      <input name="startsearch" type="hidden" id="startsearch" value="1" /></td>
  </tr>
  <tr>
    <td width="110"><label for="la_from">{#User_search_lafrom#}</label></td>
    <td><input class="input" style="width:100px" readonly="readonly" type="text" name="lastonlinefrom" id="la_from" value="{$smarty.request.lastonlinefrom|koobispecialchars}" /></td>
    <td align="right">{#User_search_latill#}</td>
    <td><input class="input" style="width:100px" readonly="readonly" type="text" name="lastonlinetill" id="la_to" value="{$smarty.request.lastonlinetill|koobispecialchars}" /></td>
  </tr>
  <tr>
    <td width="110">{#User_status#}</td>
    <td>
     <select name="aktiv" class="input" style="width:124px">
    <option value=""></option>
     <option value="1" {if $smarty.request.aktiv=='1'}selected="selected"{/if}>{#User_status_unlocked#}</option>
    <option value="0" {if $smarty.request.aktiv=='0'}selected="selected"{/if}>{#User_status_locked#}</option>
      </select>    </td>
    <td align="right">{#DataRecords#}</td>
    <td>
  <input type="text" class="input" name="limit" style="width:45px" value="{$limit}">
   <input class="button" type="submit" onclick="document.getElementById('del_innerhtml').innerHTML=''" value="{#User_search_b#}" />    </td>
  </tr>
</table>

<div id="del_innerhtml">
{if $smarty.session.UserSearch}
<fieldset>
<legend><label for="mf">{#User_multiaction_inf#}</label></legend>
{if $action_done==1}
<h3>{#User_multiaction_actiondone#}</h3>
<br />
{/if}
<select id="mf" onchange="return getformelem();" style="width:250px" class="input" name="uaction">
<option value="">{#User_multiaction_delsel#}</option>
<optgroup label="{#User_multiaction_setst#}">
    <option value="activate">{#User_multi_activate#}</option>
    <option value="deactivate">{#User_multi_deactivate#}</option>
    <option value="changegroup" id="changegroup">{#User_multiaction_setgroup#}</option>
</optgroup>

<optgroup label="{#User_multiaction_setother#}">
   <option id="sendmessage" value="sendmessage">{#User_multiaction_sendmessage#}</option>
    <option id="deltrue" value="delete">{#User_multi_del#}</option>
</optgroup>
</select>
<select class="input" name="newgroup" id="changegroup_sel" style="display:none">

<option value="">{#User_multi_groupsel#}</option>
{foreach from=$groups item=g}
    {if $g->Id!=2}<option value="{$g->Id}" {if $g->Id==$u->Gruppe}selected="selected"{/if}>{$g->Name_Intern|koobispecialchars}</option>{/if}
{/foreach}
</select>

<div id="sendmessage_elems" style="display:none">
<br />
<strong><label for="message_subject">{#User_multiaction_message_s#}</label></strong><br />
<input class="input" style="width:350px" type="text" name="message_subject" id="message_subject" /><br />
<strong><label for="message_text">{#User_multiaction_message_t#}</label></strong><br />
<textarea class="input" style="width:350px; height:100px"  name="message_text" id="message_text">{#User_multiaction_message_def#}

</textarea><br />
</div>

<input class="button" type="submit" value="{#User_multiaction_delb#}" /> 
</fieldset>
{/if}
</div>
</form>


</div>


<form method="post" action="" name="kform">
<table width="100%" border="0" cellspacing="0" cellpadding="3">

  <tr class="{cycle name=$cna values='first,second'}">
    <td class="headers">&nbsp;</td>
    <td width="150" class="headers"><a href="{$ordstr}{$name_s|default:'&sort=name_asc'}">{#Global_Name#}</a></td>
    <td width="100" align="center" class="headers"><a href="{$ordstr}{$username_s|default:'&sort=username_asc'}">{#User_username#}</a></td>
    <td width="105" class="headers"><a href="{$ordstr}{$usergroup_s|default:'&sort=usergroup_asc'}">{#User_ugroup#}</a></td>
    <td width="100" align="center" class="headers"><a href="{$ordstr}{$regdate_s|default:'&sort=regdate_desc'}">{#User_reggedon#}</a></td>
    <td width="100" align="center" class="headers"><a href="{$ordstr}{$lastonline_s|default:'&sort=lastonline_desc'}">{#User_lastonline#}</a></td>
    <td width="10" class="headers">{#Global_Actions#}</td>
    <td class="headers"><label {popup text=$config_vars.Global_SelAll}><input name="allbox" type="checkbox" id="d" onclick="selall();" value="" /></label></td>
  </tr>
  {foreach from=$user item=u}
  <tr class="{cycle name=$cna values='second,first'}">
    <td width="50" class="row_spacer">{$u->Id}</td>
    <td class="row_spacer">
    <a href="javascript:void(0);" onclick="popup('index.php?do=user&sub=edituser&user={$u->Id}&noframes=1','UserEdit',980,750,1)"><strong>{if !$u->Vorname}<em>Bearbeiten</em>{else}{$u->Vorname|truncate:'15':'.'}{/if} {$u->Nachname|koobispecialchars}</strong></a>
    <br />
    <small>{$u->Email}</small>
    <input type="hidden" name="deldetails[{$u->Id}]" value="{if !$u->Vorname}<em>Bearbeiten</em>{else}{$u->Vorname|truncate:'15':'.'}{/if} {$u->Nachname|koobispecialchars} ({$u->Email})" />
    </td>
    <td align="center" class="row_spacer">{$u->Benutzername|koobispecialchars}</td>
    <td class="row_spacer">
    
    <select class="input" style="width:100px" name="Gruppe[{$u->Id}]">
    {foreach from=$groups item=g}
    {if $g->Id!=2}<option value="{$g->Id}" {if $g->Id==$u->Gruppe}selected="selected"{/if} {if $u->Id==1}disabled="disabled"{/if}>{$g->Name_Intern|koobispecialchars}</option>{/if}
    {/foreach}
    </select>    
    
    </td>
    <td align="center" class="row_spacer">
    {$u->Regdatum|date_format:"%d.%m.%y"}   </td>
    <td align="center" class="row_spacer">{if $u->Zuletzt_Aktiv>0}{$u->Zuletzt_Aktiv|date_format:"%d.%m.%y, %H:%I"}{else}-{/if} </td>
    <td class="row_spacer" nowrap="nowrap">
    
    <a {popup sticky=$config_vars.POPSTICKY  text=$config_vars.User_edit} href="javascript:void(0);" onclick="popup('index.php?do=user&sub=edituser&user={$u->Id}&noframes=1','UserEdit',980,750,1);"><img src="{$imgpath}/edit.png" alt="" border="0" /></a>
    <a {popup sticky=$config_vars.POPSTICKY  text=$config_vars.Shop_edit_orderDownloads} href="javascript:void(0);" onclick="popup('index.php?do=shop&amp;sub=user_downloads&amp;user={$u->Id}&amp;name={$u->Nachname|koobispecialchars}&amp;noframes=1','Downloads',980,700,1);"><img src="{$imgpath}/download{if !$u->hasESD}_none{/if}.png" alt="" border="0" /></a>
    {if $is_pro==1}
    {if $u->HasOrders<1}<img {popup sticky=$config_vars.POPSTICKY  text=$config_vars.Shop_has_noorders} src="{$imgpath}/orders_none.png" alt="" border="0" />{else}
    <a {popup sticky=$config_vars.POPSTICKY  text=$config_vars.Shop_has_orders} href="javascript:void(0);" onclick="popup('index.php?do=shop&sub=orders&search=1&page=1&query={$u->Id}&noframes=1','',900,600,1,'no')"><img src="{$imgpath}/orders.png" alt="" border="0" /></a>
    {/if}{/if}
    <a {if $u->Aktiv!=1}{popup sticky=$config_vars.POPSTICKY  text=$config_vars.User_unlock}{else}{popup sticky=$config_vars.POPSTICKY  text=$config_vars.User_lock}{/if} href="javascript:void(0);" onclick="popup('index.php?do=user&sub=openclose&openclose={if $u->Aktiv!=1}open{else}close{/if}&user={$u->Id}&noframes=1','UserEdit',1,1,1);"><img src="{$imgpath}/{if $u->Aktiv!=1}closed{else}opened{/if}.png" alt="" border="0" /></a>
   </td>
    <td class="row_spacer" style="padding:0px">
    {if $u->Id==1}&nbsp;{else}
    <input {popup sticky=$config_vars.POPSTICKY  text=$config_vars.DelInfChekbox} name="del[{$u->Id}]" id="x_{$u->Id}" type="checkbox" value="1" />
   <input type="hidden" name="user[{$u->Id}]" value="{$u->Id}" />
   {/if}
    </td>
  </tr>
  
{/foreach}
</table>
<input type="hidden" name="quicksave" value="1" />
<input class="button big" type="submit" value="{#Save#}" />
</form>
{if $pages}
<br />
<div class="navi_div">
{$pages}
</div>
{/if}

<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}); 
	$("#reg_from").attachDatepicker();
	$("#reg_to").attachDatepicker();
	$("#la_from").attachDatepicker();
	$("#la_to").attachDatepicker();
	{rdelim});
</script>


