<script language="JavaScript" type="text/javascript" src="{$site_root}{$admin_theme_path}/js/images.js"></script>
<script>
{literal}
var tab_last = '1';
{/literal}
</script>
{if $ajax eq 0}
{include file="$admingentemplates/admin_top.tpl"}        
<div class="show_help" style="display: none;">&nbsp;</div>
<div class="red_header">{$lang.uploads.editform}</div>
<div class="cr">&nbsp;</div>
<div class="cr">&nbsp;</div>
    <div class="help_text" style="display:block;">
        <div class="close_help">
            <img src="{$site_root}{$template_root}/images/close_help.png" alt=""/>
        </div>
        <div class="help_body">
            <span class="help_title">{$lang.help}:</span>{$lang.admin_help.uploads_approve}
        </div>
    </div>
<ul class="tabs">
    <li>
        <a {if $info.active == "reports"} class="current" {else} href="admin_abuse_reports.php"  {/if}>{$lang.admin_abuse_reports.razdel_name} ({$count.new_abuse}/{$count.all_abuse})</a>
    </li>
    <li>
        <a {if $info.active == "bad_words"} class="current" {else} href="admin_badwords.php" {/if}>{$lang.admin_menu.bad_words} ({$count.badwords})</a>
    </li>
    <li>
        <a {if $info.active == "ip_check"} class="current" {else} href="admin_block_ip.php" {/if}>{$lang.admin_menu.block_ip} ({$count.ip})</a>
    </li>
    <li>
        <a {if $info.active == "approve"} class="current" {else} href="admin_upload.php" {/if} id="approve_count">{$lang.admin_menu.uploads_approve} ({$count.approve})</a>
    </li>
</ul>
<div class="user_operation_line">
     <div class="uol_item" onclick="AllActivate()">
        <div class="uol_in_item">{$lang.button.activate}</div>
     </div>       
     <div class="uol_item" onclick="AllAdult()">
        <div class="uol_in_item">{$lang.button.adult_content}</div>
     </div>
     <div class="uol_item" onclick="AllDelete()">
        <div class="uol_in_item">{$lang.button.delete}</div>
     </div>
</div>
<div class="cr">&nbsp;</div>
<div style="margin-top: 10px; margin-bottom: 10px;">
<form action="{$form.action}" method="post" name="settings">
<input type="hidden" name=sel value="settings"/>
{$lang.uploads.editform}
<input type="checkbox" id="foto" name="use_photo_approve" onclick="" value="1" {if $use.foto} checked=""{/if}/>{$lang.uploads.upload_1}
<input type="checkbox" id="audio" name="use_audio_approve" onclick="" value="1" {if $use.audio} checked=""{/if} />{$lang.uploads.upload_2}
<input type="checkbox" id="video" name="use_video_approve" onclick="" value="1"{if $use.video} checked=""{/if}/>{$lang.uploads.upload_3}
<!--input type="checkbox" id="icon" name="use_icon_approve" onclick="" value="1"{if $use.icon} checked=""{/if}/>{$lang.uploads.upload_5}-->
<a class="admin_button_major" onclick="document.settings.submit();;" style="margin-left: 20px;" >{$lang.button.save}<span>&nbsp;</span></a>
</form>
</div>
<div id="show_block">
{/if}
<div id="reports" style="float: left; width: 100%">
	{if $ajax ne 2}
    <form action="{$form.action}" method="post" name="type">
	<input type="hidden" name=id value="{$data.id}">
		<table border=0 cellspacing=0 cellpadding=0 width="100%">
			<tr valign=center bgcolor="#ffffff">
				<td colspan=3 align="left">
					<div id="tab_1" {if $type_upload eq 1} class="user_status_elem_active"{else} class="user_status_elem"{/if} onclick="ShowEditor('1','admin_upload.php?type_upload=1&ajax=1');">
						{if $type_upload ne 1}<a>{/if}{$lang.uploads.upload_1} ({$data.upload_1_count}){if $type_upload ne 1}</a>{/if}
					</div>
					<div id="tab_2" {if $type_upload eq 2} class="user_status_elem_active"{else} class="user_status_elem"{/if} onclick="ShowEditor('2','admin_upload.php?type_upload=2&ajax=1');">
						{if $type_upload ne 2}<a>{/if}{$lang.uploads.upload_2} ({$data.upload_2_count}){if $type_upload ne 2}</a>{/if}
					</div>
					<div id="tab_3" {if $type_upload eq 3} class="user_status_elem_active"{else} class="user_status_elem"{/if} onclick="ShowEditor('3','admin_upload.php?type_upload=3&ajax=1');">
						{if $type_upload ne 3}<a>{/if}{$lang.uploads.upload_3} ({$data.upload_3_count}){if $type_upload ne 3}</a>{/if}
					</div>
				<!--a href="admin_upload.php?type_upload=1" {if $type_upload eq 1} class="user_status_elem_active"{else} class="user_status_elem"{/if}>{$lang.uploads.upload_1} ({$data.upload_1_count})</a>
				<a href="admin_upload.php?type_upload=2" {if $type_upload eq 2} class="user_status_elem_active"{else} class="user_status_elem"{/if}>{$lang.uploads.upload_2} ({$data.upload_2_count})</a>
				<a href="admin_upload.php?type_upload=3" {if $type_upload eq 3} class="user_status_elem_active"{else} class="user_status_elem"{/if}>{$lang.uploads.upload_3} ({$data.upload_3_count})</a-->
				<!--a href="admin_upload.php?type_upload=5" {if $type_upload eq 5} class="user_status_elem_active"{else} class="user_status_elem"{/if}>{$lang.uploads.upload_5} ({$data.upload_5_count})</a-->
					</td>
					</tr>
			</table>
			</form>
    {/if}
<div id="approve" style="float: left; width: 100%;">
<div id="tooltip" onclick="hideToolTip()" style="text-align:center; background-color: #FFFFFF; border: 1px dotted; text-align: {$default_left}; position:absolute; display:none; padding:5px;"></div>
{literal}
<script type="text/javascript">
$(function() {
$('#tool_tip_4 *').tooltip();
});
</script>
{/literal}
	<form action="{$form.action}" method="post" enctype="multipart/form-data" name="uploades">
	<input type="hidden" name=sel value="change">
	<input type="hidden" name=upload_type value="{$type_upload}">
	<input type="hidden" name=page value="{$page}">
	<table border=0  cellspacing=0 cellpadding=0 width="100%">	
		<tr class="table_header">
			<td width="5%" >
				<input type="checkbox" id="select_all" name="select_all" onclick="PutAll()" /> 
			</td>
			<td width="30%">{$lang.users.fname}</td>
			<td width="40%">{$lang.admin_menu.uploads_approve}</td>
			<td width="14%">&nbsp;</td>
			<td width="25%" align="right">{$lang.users.actions}</td>
			
		</tr>
		{if $upload}	
			{section name=f loop=$upload}
			<tr {if $smarty.section.f.index mod 2 eq 1}class="even"{else}class="odd"{/if}>
				<td style="padding-left: 10px;" valign="top"><input type="checkbox" name="delete" value="{$upload[f].id}" /></td>
				<td  valign="top"><a href="{$upload[f].userlink}">{$upload[f].username}</a></td>
				{if $type_upload == 2}
					<td class="audio_row">
						<span id="player{$smarty.section.f.index}" align=absmiddle>
							<script type="text/javascript">
								var fv = "file={$upload[f].file}&autostart=false&title={$upload[f].name|escape}&lightcolor=0xD12627";
								{literal}
									var FO = {
										movie:"{/literal}{$site_root}{literal}/include/mp3player/mp3player.swf",width:"235",height:"20",majorversion:"7",build:"0",bgcolor:"#FFFFFF", flashvars:fv
									};
								{/literal}
								UFO.create(FO, "player{$smarty.section.f.index}");
							</script>
						</span>
					</td>
				{else}
					<td>{$upload[f].file}</td>
				{/if}
				<td>{if $upload[f].icon_id eq $upload[f].id}{$lang.users.icon_name}{/if}</td>
				<td  valign="top">
					<div class="block_action fr" style="display: none;">
						<div class="action_del" style="display: block;">				
							<img src="{$site_root}{$template_root}/images/photo_delete.png" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.button.delete}');return false" height="15px" width="15px" alt="" onclick="Del({$upload[f].id}, {if $upload[f].icon_id eq $upload[f].id}1{else}0{/if}, 1)" style="cursor: pointer;" />
						</div>
					</div>
					<div style="width:10px;float:right;" class="fl">&nbsp;</div>
					{if $upload[f].icon_id ne $upload[f].id}
					<div class="block_action fr" style="display: none;">
						<div class="action_del" style="display: block;">				
							<img src="{$site_root}{$template_root}/images/adult content.png" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.button.adult_content}');return false" height="15px" width="15px" alt="" onclick="Adult({$upload[f].id}, {if $upload[f].icon_id eq $upload[f].id}1{else}0{/if}, 1)" style="cursor: pointer;" />
						</div>
					</div><div style="width:10px;float:right;" class="fl">&nbsp;</div>
					{/if}
					<div class="block_action fr" style="display: none;">
						<div class="action_edit" style="display: block;">
							<img src="{$site_root}{$template_root}/images/icn_active.png" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.button.make_active}');return false" height="15px" width="15px" alt="" onclick="Activate({$upload[f].id}, {if $upload[f].icon_id eq $upload[f].id}1{else}0{/if}, 1)" style="cursor: pointer;" />
						</div>
					</div>
				</td>
			</tr>
			{/section}	
		{else}
			<tr height="10" bgcolor="#ffffff">
				<td align="center" class="main_error_text" colspan=4 height="30">&nbsp;{$lang.uploads.empty}&nbsp;</td>
			</tr>
		{/if}		
					
		<tr class="table_header">
			<td colspan="11">
				&nbsp;&nbsp;
				{if $links}
				{foreach item=item from=$links.pages}
					&nbsp;<a onclick="PageList('bad_words', '{$item.link}');" class="page_link" {if $item.selected} style=" font-weight: bold; text-decoration: none;" {/if}>{$item.name}</a>&nbsp;
				{/foreach}
				{/if}
				<div class="page_navigation">
				{if $links.previous}
					<a onclick="PageList('bad_words', '{$links.previous}');">< {$lang.content.previous} {$per_page}</a>
				{/if}
				{if $links.next}
					<a onclick="PageList('approve', '{$links.next}');">{$lang.content.next} {$per_page} ></a>
				{/if}
				</div>
			</td>
		</tr>
	</table>
	</form>
<script type="text/javascript">
{literal}
	function showToolTip(e,text){
		if(document.all)e = event;
		var obj = document.getElementById('tooltip');
		obj.innerHTML = text;
		obj.style.display = 'block';
		var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
		if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0;
		var leftPos = e.clientX - $('#tooltip').width()-10;
		if(leftPos<0)leftPos = 0;
		obj.style.left = leftPos + 'px';
		obj.style.top = e.clientY - obj.offsetHeight -10 + st + 'px';
	}
	function hideToolTip(){
		document.getElementById('tooltip').style.display = 'none';
	}
{/literal}		
</script>
</div>
</div></div>
<script type="text/javascript">
{literal}
var chislo = {/literal}{$count.approve}{literal}

function PageList(id_div, par) {
        ajaxLoadingImage(1, 'approve');
        $.post("admin_upload.php", par, function(data){
            ajaxLoadingImage(0, 'approve');
            $('#approve').html(data);
        });
    }
    
function PutAll() {
         var o=document.getElementsByName('select_all')	
         var i
         if (o[0].checked){                    
            o=document.getElementsByName('delete')
            for (i=0; i<o.length; i++){                
                o[i].checked = true
            }            
         }
         else{
            o=document.getElementsByName('delete')
            for (i=0; i<o.length; i++){                
                o[i].checked = false
            }            
         }             
}

function AllActivate(){
	var res = [];
	i = 0;
	$('input[name=delete]:checked').each(function(){
		res[i] = $(this).val();
		i++;
	});
	Activate(res, '', i);
}

function AllAdult(){
	var res = [];
	i = 0;
	$('input[name=delete]:checked').each(function(){
		res[i] = $(this).val();
		i++;
	});
	Adult(res, '', i);
    /*$('input[name=delete]:checked').each(function(){
        Adult($(this).val())
    });*/
}

function AllDelete(){
	var res = [];
	i = 0;
	$('input[name=delete]:checked').each(function(){
		res[i] = $(this).val();
		i++;
	});
	Del(res, '', i);
   /* $('input[name=delete]:checked').each(function(){
        Del($(this).val())
     });*/
}

function Activate(arr_id, id_icon, i){
	chislo = chislo - i;
    var element = document.getElementById('approve_count');
	if (id_icon)
		var par = "sel=change&ajax=1&page="+{/literal}{$page}{literal}+"&id_files="+arr_id+"&upload_type=5";
	else
		var par = "sel=change&ajax=1&page="+{/literal}{$page}{literal}+"&id_files="+arr_id+"&upload_type="+{/literal}{$type_upload}{literal};
    element.innerHTML = {/literal}"{$lang.admin_menu.uploads_approve} ("+chislo+")"{literal}

    $.post("admin_upload.php", par, function(data){
        $('#reports').html(data);
    })
}

function Adult(id, icon, i){
    chislo = chislo - i;
    var element = document.getElementById('approve_count');
    element.innerHTML = {/literal}"{$lang.admin_menu.uploads_approve} ("+chislo+")"{literal};
	if (icon)
		var par = "sel=adult&ajax=1&page="+{/literal}{$page}{literal}+"&id_files="+id+"&upload_type=5";
	else
		var par = "sel=adult&ajax=1&page="+{/literal}{$page}{literal}+"&id_files="+id+"&upload_type="+{/literal}{$type_upload}{literal};
    $.post("admin_upload.php", par, function(data){
        $('#reports').html(data);
    })
}

function Del(id, icon, i){
    chislo = chislo - i;    
    var element = document.getElementById('approve_count');
    element.innerHTML = {/literal}"{$lang.admin_menu.uploads_approve} ("+chislo+")"{literal};
	if (icon)
		var par = "sel=delete&ajax=1&page="+{/literal}{$page}{literal}+"&id_files="+id+"&upload_type=5";
	else
		var par = "sel=delete&ajax=1&page="+{/literal}{$page}{literal}+"&id_files="+id+"&upload_type="+{/literal}{$type_upload}{literal};
    $.post("admin_upload.php", par, function(data){
        $('#reports').html(data);
    })
}

function SaveSettings(){
    
}
{/literal}
</script>
{if $ajax eq 0}
{include file="$admingentemplates/admin_bottom.tpl"}
{/if}