From 8edce43ea40a3957772bde41f4359eebf841d7b1 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 9 Apr 2009 10:33:35 -0400 Subject: [PATCH] Switch the 'modify' code of admin/field.php to use templates * admin/field.php * admin/templates/field.html * admin/templates/nav.html --- admin/field.php | 36 ++++++--------------------- admin/templates/field.html | 51 ++++++++++++++++++++++++++++++++++++++ admin/templates/nav.html | 2 +- 3 files changed, 59 insertions(+), 30 deletions(-) create mode 100644 admin/templates/field.html diff --git a/admin/field.php b/admin/field.php index 6abc03e..9bb4a29 100644 --- a/admin/field.php +++ b/admin/field.php @@ -19,14 +19,13 @@ || ################################################################### \*=====================================================================*/ +$fetchtemplates = array( + 'field' +); + require_once('./global.php'); require_once('./includes/api_field.php'); -APIError(array(new API_Error_Handler($admin), 'admin_error')); - -NavLinks::fieldsPages(); -$navigator->set_focus('tab', 'fields', null); - if (!can_perform('canadminfields')) { admin_login(); @@ -277,30 +276,9 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') if ($_REQUEST['do'] == 'modify') { - NavLinks::fieldsAdd(); - $navigator->set_focus('link', 'fields-pages-fields', 'fields-pages'); - - $admin->page_start(T('Additional Bug Fields')); - - $admin->table_start(); - $admin->table_head(T('Additional Bug Fields'), 3, 'custom_bug_fields'); - $admin->table_column_head(array(T('Display Name/Description'), T('Field ID'), T('Actions'))); - - $fields = $db->query("SELECT * FROM " . TABLE_PREFIX . "bugfield ORDER BY fieldid ASC"); - foreach ($fields as $field) - { - $admin->row_multi_item( - array( - "$field[name]
$field[description]
" => 'l', - "$field[fieldid]" => 'c', - "[" . T('Edit') . "] [" . T('Delete') . "]" => 'c' - ) - ); - } - - $admin->table_end(); - - $admin->page_end(); + $tpl = new BSTemplate('field'); + $tpl->vars['fields'] = $db->query("SELECT * FROM " . TABLE_PREFIX . "bugfield ORDER BY fieldid ASC"); + $tpl->evaluate()->flush(); } ?> \ No newline at end of file diff --git a/admin/templates/field.html b/admin/templates/field.html new file mode 100644 index 0000000..c8d64ff --- /dev/null +++ b/admin/templates/field.html @@ -0,0 +1,51 @@ +<%- $templates['doctype'] %> + + + <%- $templates['headinclude'] %> + <%- $templates['title'] %> - <%- T('Custom Fields') %> + + + + +<%- $templates['nav'] %> + +
<%- T('Custom Fields') %>
+ +
+ +<%- admin_flash() %> + + + + + + + + + + +<% $i = 0; foreach ($fields as $field): %> + + + + + +<% $i++ %> +<% endforeach %> +
<%- T('Custom Fields') %>
<%- T('Display Name/Description') %><%- T('Field ID') %><%- T('Actions') %>
+ <%- $field['name'] %> + <%- $field['description'] %> + <%- $field['fieldid'] %> + <%- T('Edit') %> + <%- T('Delete') %> +
+ +<%- admin_footer() %> + +
+ + + + + + \ No newline at end of file diff --git a/admin/templates/nav.html b/admin/templates/nav.html index b70f900..9a7e58c 100644 --- a/admin/templates/nav.html +++ b/admin/templates/nav.html @@ -23,7 +23,7 @@