<!-- $Id: article_list.htm 16783 2009-11-09 09:59:06Z liuhui $ -->

{if $full_page}
{include file="pageheader.htm"}
{insert_scripts files="../js/utils.js,listtable.js"}
<div class="form-div">
  <form action="javascript:searchArticle()" name="searchForm" >
    <img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />
    <select name="cat_id" >
      <option value="0">{$lang.all_cat}</option>
        {$cat_select}
    </select>
    {$lang.title} <input type="text" name="keyword" id="keyword" />
    <input type="submit" value="{$lang.button_search}" class="button" />
  </form>
</div>
<form method="POST" action="article.php?act=batch_remove" name="listForm">
<div class="list-div" id="listDiv">
{/if}
<table cellspacing='1' cellpadding='3' id='list-table'>
  <tr>
    <th><input onclick='listTable.selectAll(this, "checkboxes")' type="checkbox">
      <a href="javascript:listTable.sort('article_id'); ">{$lang.article_id}</a>{$sort_article_id}</th>
    <th><a href="javascript:listTable.sort('title'); ">{$lang.title}</a>{$sort_title}</th>
    <th><a href="javascript:listTable.sort('cat_id'); ">{$lang.cat}</a>{$sort_cat_id}</th>
    <th><a href="javascript:listTable.sort('article_type'); ">{$lang.article_type}</a>{$sort_article_type}</th>
    <th><a href="javascript:listTable.sort('is_open'); ">{$lang.is_open}</a>{$sort_is_open}</th>
    <th><a href="javascript:listTable.sort('add_time'); ">{$lang.add_time}</a>{$sort_add_time}</th>
    <th>{$lang.handler}</th>
  </tr>
  {foreach from=$article_list item=list}
  <tr>
    <td><span><input name="checkboxes[]" type="checkbox" value="{$list.article_id}" {if $list.cat_id <= 0 }disabled="true"{/if}/>{$list.article_id}</span></td>
    <td class="first-cell">
    <span onclick="javascript:listTable.edit(this, 'edit_title', {$list.article_id})">{$list.title|escape:html}</span></td>
    <td align="left"><span><!-- {if $list.cat_id > 0} -->{$list.cat_name|escape:html}<!-- {else} -->{$lang.reserve}<!-- {/if} --></span></td>
    <td align="center"><span>{if $list.article_type eq 0}{$lang.common}{else}{$lang.top}{/if}</span></td>
    <td align="center">{if $list.cat_id > 0}<span>
    <img src="images/{if $list.is_open eq 1}yes{else}no{/if}.gif" onclick="listTable.toggle(this, 'toggle_show', {$list.article_id})" /></span>{else}<img src="images/yes.gif" alt="yes" />{/if}</td>
    <td align="center"><span>{$list.date}</span></td>
    <td align="center" nowrap="true"><span>
      <a href="../article.php?id={$list.article_id}" target="_blank" title="{$lang.view}"><img src="images/icon_view.gif" border="0" height="21" width="21" /></a>&nbsp;
      <a href="article.php?act=edit&id={$list.article_id}" title="{$lang.edit}"><img src="images/icon_edit.gif" border="0" height="21" width="21" /></a>&nbsp;
     <!-- {if $list.cat_id > 0} --><a href="javascript:;" onclick="listTable.remove({$list.article_id}, '{$lang.drop_confirm}')" title="{$lang.remove}"><img src="images/icon_drop.gif" border="0" height="21" width="21"></a><!-- {/if} --></span>
    </td>
   </tr>
   {foreachelse}
    <tr><td class="no-records" colspan="10">{$lang.no_article}</td></tr>
  {/foreach}
  <tr>
    <td align="right" nowrap="true" colspan="8">{include file="page.htm"}</td>
  </tr>
</table>
{if $full_page}
</div>

<div>
  <input type="hidden" name="act" value="batch" />
  <select name="type" id="selAction" onchange="changeAction()">
    <option value="">{$lang.select_please}</option>
    <option value="button_remove">{$lang.button_remove}</option>
    <option value="button_hide">{$lang.button_hide}</option>
    <option value="button_show">{$lang.button_show}</option>
    <option value="move_to">{$lang.move_to}</option>
  </select>
  <select name="target_cat" style="display:none">
    <option value="0">{$lang.select_please}</option>
    {$cat_select}
  </select>

  <input type="submit" value="{$lang.button_submit}" id="btnSubmit" name="btnSubmit" class="button" disabled="true" />
</div>
</form>
<!-- end cat list -->
<script type="text/javascript" language="JavaScript">
  listTable.recordCount = {$record_count};
  listTable.pageCount = {$page_count};

  {foreach from=$filter item=item key=key}
  listTable.filter.{$key} = '{$item}';
  {/foreach}
  {literal}

  onload = function()
  {
    // 开始检查订单
    startCheckOrder();
  }
	/**
   * @param: bool ext 其他条件：用于转移分类
   */
  function confirmSubmit(frm, ext)
  {
      if (frm.elements['type'].value == 'button_remove')
      {
          return confirm(drop_confirm);
      }
      else if (frm.elements['type'].value == 'not_on_sale')
      {
          return confirm(batch_no_on_sale);
      }
      else if (frm.elements['type'].value == 'move_to')
      {
          ext = (ext == undefined) ? true : ext;
          return ext && frm.elements['target_cat'].value != 0;
      }
      else if (frm.elements['type'].value == '')
      {
          return false;
      }
      else
      {
          return true;
      }
  }
	 function changeAction()
  {
		
      var frm = document.forms['listForm'];

      // 切换分类列表的显示
      frm.elements['target_cat'].style.display = frm.elements['type'].value == 'move_to' ? '' : 'none';

      if (!document.getElementById('btnSubmit').disabled &&
          confirmSubmit(frm, false))
      {
          frm.submit();
      }
  }

 /* 搜索文章 */
 function searchArticle()
 {
    listTable.filter.keyword = Utils.trim(document.forms['searchForm'].elements['keyword'].value);
    listTable.filter.cat_id = parseInt(document.forms['searchForm'].elements['cat_id'].value);
    listTable.filter.page = 1;
    listTable.loadList();
 }

 {/literal}
</script>
{include file="pagefooter.htm"}
{/if}
