list.tpl 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <div id="overview">
  2. <form name="frmOverview" method="post" action="">
  3. {if ($admin_list|count > 1)}
  4. {html_options name='username' output=$admin_list values=$admin_list selected=$admin_selected onchange="this.form.submit();"}
  5. <noscript><input class="button" type="submit" name="go" value="{$PALANG.go}" /></noscript>
  6. {/if}
  7. </form>
  8. {if $msg.show_simple_search}
  9. {#form_search#}
  10. {/if}
  11. </div>
  12. {if $msg.show_simple_search}
  13. {if ($search|count > 0)}
  14. <div class='searchparams'>
  15. <p>{$PALANG.searchparams}
  16. {foreach key=key item=field from=$search}
  17. <span>{if $struct.$key.label}{$struct.$key.label}{else}{$key}{/if}
  18. {if isset($searchmode.$key)}{$searchmode.$key}{else}={/if} {$field}
  19. </span>
  20. {/foreach}
  21. <span><a href="list.php?table={$table}&reset_search=1">[x]</a></span>
  22. </div>
  23. {/if}
  24. {/if}
  25. <div id="list">
  26. <table border=0 id='admin_table'><!-- TODO: 'admin_table' needed because of CSS for table header -->
  27. {if $msg.list_header}
  28. {assign var="colcount" value=2}
  29. {foreach key=key item=field from=$struct}
  30. {if $field.display_in_list == 1 && $field.label}{* don't show fields without a label *}
  31. {assign var="colcount" value=$colcount+1}
  32. {/if}
  33. {/foreach}
  34. <tr>
  35. <th colspan="{$colcount}">{$PALANG.{$msg.list_header}}</th>
  36. </tr>
  37. {/if}
  38. <tr class="header">
  39. {foreach key=key item=field from=$struct}
  40. {if $field.display_in_list == 1 && $field.label}{* don't show fields without a label *}
  41. <td>{$field.label}</td>
  42. {/if}
  43. {/foreach}
  44. <td>&nbsp;</td>
  45. <td>&nbsp;</td>
  46. </tr>
  47. {foreach from=$items item=item}
  48. {#tr_hilightoff#}
  49. {foreach key=key item=field from=$struct}
  50. {if $field.display_in_list == 1 && $field.label}
  51. {if $field.linkto != '' && ($item.$id_field != '' || $item.$id_field > 0) }
  52. {assign "linkto" "{$field.linkto|replace:'%s':{$item.$id_field|escape:url}}"} {* TODO: use label field instead *}
  53. {assign "linktext" "<a href='{$linkto}'>{$item.{$key}}</a>"}
  54. {else}
  55. {assign "linktext" $item.$key}
  56. {/if}
  57. {if $table == 'foo' && $key == 'bar'}
  58. <td>Special handling (complete table row) for {$table} / {$key}</td></tr>
  59. {else}
  60. <td>
  61. {if $table == 'foo' && $key == 'bar'}
  62. Special handling (td content) for {$table} / {$key}
  63. {elseif $table == 'aliasdomain' && $key == 'target_domain' && $struct.target_domain.linkto == 'target'}
  64. <a href="list-virtual.php?domain={$item.target_domain|escape:"url"}">{$item.target_domain}</a>
  65. {* {elseif $table == 'domain' && $key == 'domain'}
  66. <a href="list.php?table=domain&domain={$item.domain|escape:"url"}">{$item.domain}</a>
  67. *}
  68. {elseif $key == 'active'}
  69. {if $item._can_edit}
  70. <a href="{#url_editactive#}{$table}&amp;id={$item.$id_field|escape:"url"}&amp;active={if ($item.active==0)}1{else}0{/if}&amp;token={$smarty.session.PFA_token|escape:"url"}">{$item._active}</a>
  71. {else}
  72. {$item._active}
  73. {/if}
  74. {elseif $field.type == 'bool'}
  75. {assign "tmpkey" "_{$key}"}{$item.{$tmpkey}}
  76. {elseif $field.type == 'list'}
  77. {foreach key=key2 item=field2 from=$item.$key}{$field2}<br> {/foreach}
  78. {elseif $field.type == 'pass'}
  79. (hidden)
  80. {elseif $field.type == 'quot'}
  81. {assign "tmpkey" "_{$key}_percent"}
  82. {if $item[$tmpkey]>90}
  83. {assign var="quota_level" value="high"}
  84. {elseif $item[$tmpkey]>55}
  85. {assign var="quota_level" value="mid"}
  86. {else}
  87. {assign var="quota_level" value="low"}
  88. {/if}
  89. {if $item[$tmpkey] > -1}
  90. <div class="quota quota_{$quota_level}" style="width:{$item[$tmpkey] *1.2}px;"></div>
  91. <div class="quota_bg"></div></div>
  92. <div class="quota_text quota_text_{$quota_level}">{$linktext}</div>
  93. {else}
  94. <div class="quota_bg quota_no_border"></div></div>
  95. <div class="quota_text">{$linktext}</div>
  96. {/if}
  97. {elseif $field.type == 'txtl'}
  98. {foreach key=key2 item=field2 from=$item.$key}{$field2}<br> {/foreach}
  99. {elseif $field.type == 'html'}
  100. {$RAW_items.{$item.{$msg.id_field}}.$key}
  101. {else}
  102. {$linktext}
  103. {/if}
  104. </td>
  105. {/if}
  106. {/if}
  107. {/foreach}
  108. <td>{if $item._can_edit}<a href="edit.php?table={$table|escape:"url"}&amp;edit={$item.$id_field|escape:"url"}">{$PALANG.edit}</a>{else}&nbsp;{/if}</td>
  109. <td>{if $item._can_delete}<a href="{#url_delete#}?table={$table}&amp;delete={$item.$id_field|escape:"url"}&amp;token={$smarty.session.PFA_token|escape:"url"}"
  110. onclick="return confirm ('{$PALANG.{$msg.confirm_delete}|replace:'%s':$item.$id_field}')">{$PALANG.del}</a>{else}&nbsp;{/if}</td>
  111. </tr>
  112. {/foreach}
  113. </table>
  114. {if $msg.can_create}
  115. <br /><a href="edit.php?table={$table|escape:"url"}" class="button">{$PALANG.{$formconf.create_button}}</a><br />
  116. <br />
  117. {/if}
  118. <br /><a href="list.php?table={$table|escape:"url"}&amp;output=csv">{$PALANG.download_csv}</a>
  119. </div>