From fab44f72a89396d624be49311fc0622635d44f8a Mon Sep 17 00:00:00 2001 From: rub Date: Sun, 2 Mar 2008 17:30:18 +0000 Subject: 0000810: Use of new template engine [smarty] Migration of c13y template It's the first step with simple migration, on next step more display action on tpl. git-svn-id: http://piwigo.org/svn/trunk@2241 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/check_integrity.class.php | 58 ++++++-------- template/yoga/admin/check_integrity.tpl | 129 ++++++++++++++++---------------- 2 files changed, 88 insertions(+), 99 deletions(-) diff --git a/admin/include/check_integrity.class.php b/admin/include/check_integrity.class.php index eeeb6f7dd..298edb6e3 100644 --- a/admin/include/check_integrity.class.php +++ b/admin/include/check_integrity.class.php @@ -192,20 +192,23 @@ class check_integrity foreach ($this->retrieve_list as $i => $c13y) { $can_select = false; - - $template->assign_block_vars('c13y', - array( - 'CLASS' => ($i % 2 == 1) ? 'row2' : 'row1', + $c13y_display = array( 'ID' => $c13y['id'], - 'ANOMALY' => $c13y['anomaly'] - )); - + 'ANOMALY' => $c13y['anomaly'], + 'show_ignore_msg' => false, + 'show_correction_success_fct' => false, + 'correction_error_fct' => '', + 'show_correction_fct' => false, + 'correction_error_fct' => '', + 'show_correction_bad_fct' => false, + 'correction_msg' => '' + ); if (isset($c13y['ignored'])) { if ($c13y['ignored']) { - $template->assign_block_vars('c13y.ignore_msg', array()); + $c13y_display['show_ignore_msg'] = true; } else { @@ -220,24 +223,23 @@ class check_integrity { if ($c13y['corrected']) { - $template->assign_block_vars('c13y.correction_success_fct', array()); + $c13y_display['show_correction_success_fct'] = true; } else { - $template->assign_block_vars('c13y.correction_error_fct', - array('WIKI_FOROM_LINKS' => $this->get_htlm_links_more_info())); + $c13y_display['correction_error_fct'] = $this->get_htlm_links_more_info(); } } else if ($c13y['is_callable']) { - $template->assign_block_vars('c13y.correction_fct', array()); - $template->assign_block_vars('c13y_link_check_automatic_correction.c13y_do_check', array('ID' => $c13y['id'])); + $c13y_display['show_correction_fct'] = true; + $template->append('c13y_do_check', $c13y['id']); $submit_automatic_correction = true; $can_select = true; } else { - $template->assign_block_vars('c13y.correction_bad_fct', array()); + $c13y_display['show_correction_bad_fct'] = true; $can_select = true; } } @@ -246,39 +248,25 @@ class check_integrity $can_select = true; } - if (!empty($c13y['correction_fct']) and !empty($c13y['correction_msg'])) - { - $template->assign_block_vars('c13y.br', array()); - } - if (!empty($c13y['correction_msg']) and !isset($c13y['corrected'])) { - $template->assign_block_vars('c13y.correction_msg', - array( - 'DATA' => nl2br($c13y['correction_msg']) - )); + $c13y_display['correction_msg'] = $c13y['correction_msg']; } } + $c13y_display['can_select'] = $can_select; if ($can_select) { - $template->assign_block_vars('c13y.can_select', array()); $submit_ignore = true; } + + $template->append('c13y_list', $c13y_display); } - if ($submit_automatic_correction) - { - $template->assign_block_vars('c13y_submit_automatic_correction', array()); - } - - if ($submit_ignore) - { - $template->assign_block_vars('c13y_link_check_uncheck', array()); - $template->assign_block_vars('c13y_submit_ignore', array()); - } + $template->assign('c13y_show_submit_automatic_correction', $submit_automatic_correction); + $template->assign('c13y_show_submit_ignore', $submit_ignore); - $template->concat_var('ADMIN_CONTENT', $template->parse('check_integrity', true) ); + $template->assign_var_from_handle('ADMIN_CONTENT', 'check_integrity'); } } diff --git a/template/yoga/admin/check_integrity.tpl b/template/yoga/admin/check_integrity.tpl index 245a666ca..7bbd1183f 100644 --- a/template/yoga/admin/check_integrity.tpl +++ b/template/yoga/admin/check_integrity.tpl @@ -1,81 +1,82 @@ - - +{* $Id$ *}
-
{lang:c13y_title}
+
{'c13y_title'|@translate}
    -
    +
    - - + + - - - - - - - + {if isset($c13y_list)} + {foreach from=$c13y_list item=c13y name=c13y_loop} + + + + + + {/foreach} + {/if}
    {lang:c13y_Anomaly}{lang:c13y_Correction}{'c13y_Anomaly'|@translate}{'c13y_Correction'|@translate}
    - - - - - -
    + {if $c13y.can_select} + + {/if} + + +

    - - {lang:c13y_check_all} - / {lang:c13y_uncheck_all} - - - / {lang:c13y_check_auto} - + {if $c13y_show_submit_ignore} + {'c13y_check_all'|@translate} + / {'c13y_uncheck_all'|@translate} + {/if} + {if isset($c13y_do_check)} + / {'c13y_check_auto'|@translate} + {/if}

    - - - - - - - -

    + {if $c13y_show_submit_automatic_correction} + + {/if} + {if $c13y_show_submit_ignore} + + {/if} + +

    -- cgit v1.2.3