<mt:if name="request.not_refreshed">
    <mtapp:statusmsg
       id="not-refreshed"
       class="error"
       can_close="0">
      <__trans phrase="Some templates were not refreshed.">
    </mtapp:statusmsg>
</mt:if>
<mt:if name="request.not_deleted">
    <mt:if name="object_type" eq="website">
        <mtapp:statusmsg
           id="not-deleted"
           class="error"
           can_close="0">
          <__trans phrase="Some websites were not deleted. You need to delete blogs under the website first.">
        </mtapp:statusmsg>
    </mt:if>
</mt:if>

<mt:setvarblock name="action_buttons">
<mt:if name="is_administrator">
  <button
     type="button"
     accesskey="x"
     title="<__trans phrase="Delete selected [_1] (x)" params="<mt:var name="object_type_plural" lower_case="1">">"
     class="button mt-delete-items">
    <__trans phrase="Delete">
  </button>
</mt:if>
</mt:setvarblock>

<mtapp:listing>
<mt:if name="__first__">
  <mt:setvarblock name="table_header">
  <tr>
    <th class="col head cb"><input type="checkbox" name="id-head" value="all" class="select" /></th>
    <th class="col head name primary"><span class="col-label"><__trans phrase="[_1] Name" params="<mt:var name="object_label" capitalize="1">"></span></th>
  <mt:if name="object_type" eq="website">
    <th class="col head blog"><span class="col-label"><__trans phrase="Blogs"></span></th>
    <th class="col head entry"><span class="col-label"><__trans phrase="Pages"></span></th>
  <mt:else>
    <mt:if name="scope_type" eq="system">
    <th class="col head website"><span class="col-label"><__trans phrase="Website"></span></th>
    </mt:if>
    <th class="col head entries num"><span class="col-label"><__trans phrase="Entries"></span></th>
  </mt:if>
    <th class="col head comments num"><span class="col-label"><__trans phrase="Comments"></span></th>
    <th class="col head setting"><span class="col-label"><__trans phrase="Settings"></span></th>
  </tr>
  </mt:setvarblock>
  <thead>
    <mt:var name="table_header">
  </thead>
  <tfoot>
    <mt:var name="table_header">
  </tfoot>
  <tbody>
</mt:if>
    <tr class="<mt:if name="__odd__">odd<mt:else>even</mt:if>">
      <td class="col cb"><input type="checkbox" name="id" value="<mt:var name="id">" class="select"<mt:if checked> checked="checked"</mt:if> /></td>
      <td class="col name"><a href="?__mode=dashboard&amp;blog_id=<mt:var name="id">"><mt:var name="name" escape="html"></a></td>
    <mt:if name="object_type" eq="website">
      <td class="col blog"><mt:if name="can_list_blogs"><a href="<mt:var name="script_url">?__mode=list&amp;_type=blog&amp;blog_id=<mt:var name="id">"><mt:var name="num_blogs"></a><mt:else><mt:var name="num_blogs"></mt:if></td>
      <td class="col entry"><mt:if name="can_edit_pages"><a href="<mt:var name="script_url">?__mode=list&amp;_type=page&amp;blog_id=<mt:var name="id">&amp;filter_key=this_website"><mt:var name="num_pages"></a><mt:else><mt:var name="num_pages"></mt:if></td>
    <mt:else>
      <mt:if name="scope_type" eq="system">
      <td class="col website">
        <mt:if name="can_access_to_website">
        <a href="<mt:var name="script_url">?__mode=dashboard&amp;blog_id=<mt:var name="website_id">"><mt:var name="website_name" escape="html"></a><mt:else><mt:var name="website_name" escape="html">
        </mt:if>
      </td>
      </mt:if>
      <td class="col entries"><mt:if name="can_edit_entries"><a href="<mt:var name="script_url">?__mode=list&amp;_type=entry&amp;blog_id=<mt:var name="id">"><mt:var name="num_entries"></a><mt:else><mt:var name="num_entries"></mt:if></td>
    </mt:if>
      <td class="col comments"><mt:if name="can_edit_entries"><a href="<mt:var name="script_url">?__mode=list&amp;_type=comment&amp;blog_id=<mt:var name="id"><mt:if name="object_type" eq="website">&amp;filter_key=this_website</mt:if>"><mt:var name="num_comments"></a><mt:else><mt:var name="num_comments"></mt:if></td>
      <td class="col setting"><mt:if name="can_edit_config"><a href="<mt:var name="script_url">?__mode=cfg_prefs&amp;blog_id=<mt:var name="id">"><__trans phrase="Settings"></a><mt:else>&nbsp;</mt:if></td>
    </tr>
<mt:if name="__last__">
  </tbody>
</mt:if>
</mtapp:listing>

<mt:setvarblock name="jq_js_include" append="1">
    jQuery('button.mt-delete-items').mtDeleteItems({
        id: '<$mt:var name="object_type"$>-listing-form',
        singular: '<mt:var name="object_label" lower_case="1" escape="js">',
        plural: '<mt:var name="object_label_plural" lower_case="1" escape="js">',
        args: {<mt:if name="search">'search': '<mt:var name="search" escape="js">'</mt:if>}
    });
    jQuery('button.mt-<mt:var name="form_id">-action').mtDoPluginAction({
        id: '<mt:var name="form_id">',
        plural: '<mt:if name="object_label_plural"><mt:var name="object_label_plural" escape="js"></mt:if>',
        args: {<mt:if name="search">'search': '<mt:var name="search" escape="js">'</mt:if>},
        phrase: '<__trans phrase="to act upon" escape="js">'
    });
</mt:setvarblock>
