diff options
author | rub <rub@piwigo.org> | 2008-03-02 17:30:18 +0000 |
---|---|---|
committer | rub <rub@piwigo.org> | 2008-03-02 17:30:18 +0000 |
commit | fab44f72a89396d624be49311fc0622635d44f8a (patch) | |
tree | 670bda7649296c1dbecb7c86608b59e8c4c232a3 | |
parent | 6e932e8752faae824cdcb1073014771163a600a7 (diff) |
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
-rw-r--r-- | admin/include/check_integrity.class.php | 58 | ||||
-rw-r--r-- | 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 @@ -<!-- DEV TAG: not smarty migrated --> -<!-- $Id$ --> +{* $Id$ *} <dl> - <dt>{lang:c13y_title}</dt> + <dt>{'c13y_title'|@translate}</dt> <dd> <ul> - <form method="post" name="c13y" id="c13y" action="{F_c13y_ACTION}"> + <form method="post" name="c13y" id="c13y" action="{$F_C13Y_ACTION}"> <fieldset> <table class="table2"> <tr class="throw"> <th></th> - <th>{lang:c13y_Anomaly}</th> - <th>{lang:c13y_Correction}</th> + <th>{'c13y_Anomaly'|@translate}</th> + <th>{'c13y_Correction'|@translate}</th> </tr> - <!-- BEGIN c13y --> - <tr class="{c13y.CLASS}"> - <td> - <!-- BEGIN can_select --> - <input type="checkbox" name="c13y_selection[]" value="{c13y.ID}" {c13y.CHECKED} id="c13y_selection-{c13y.ID}" /><label for="c13y_selection-{c13y.ID}"></label> - <!-- END can_select --> - </td> - <td><label for="c13y_selection-{c13y.ID}">{c13y.ANOMALY}</label></td> - <td> - <label for="c13y_selection-{c13y.ID}"> - <!-- BEGIN ignore_msg --> - {lang:c13y_ignore_msg1} - <br /> - {lang:c13y_ignore_msg2} - <!-- END ignore_msg --> - <!-- BEGIN correction_fct --> - {lang:c13y_Automatic_correction} - <!-- END correction_fct --> - <!-- BEGIN correction_bad_fct --> - {lang:c13y_Impossible_automatic_correction} - <!-- END correction_bad_fct --> - <!-- BEGIN correction_success_fct --> - {lang:c13y_Correction_applied_success} - <!-- END correction_success_fct --> - <!-- BEGIN correction_error_fct --> - {lang:c13y_Correction_applied_error} - <BR /> - {c13y.correction_error_fct.WIKI_FOROM_LINKS} - <!-- END correction_error_fct --> - <!-- BEGIN br --> - <br /> - <!-- END br --> - <!-- BEGIN correction_msg --> - {c13y.correction_msg.DATA} - <!-- END correction_msg --> - </label> - </td> - </tr> - <!-- END c13y --> + {if isset($c13y_list)} + {foreach from=$c13y_list item=c13y name=c13y_loop} + <tr class="{if $smarty.foreach.c13y_loop.index is odd}row1{else}row2{/if}"> + <td> + {if $c13y.can_select} + <input type="checkbox" name="c13y_selection[]" value="{$c13y.ID}" {$c13y.CHECKED} id="c13y_selection-{$c13y.ID}" /><label for="c13y_selection-{$c13y.ID}"></label> + {/if} + </td> + <td><label for="c13y_selection-{$c13y.ID}">{$c13y.ANOMALY}</label></td> + <td> + <label for="c13y_selection-{$c13y.ID}"> + {if $c13y.show_ignore_msg} + {'c13y_ignore_msg1'|@translate} + <br /> + {'c13y_ignore_msg2'|@translate} + {/if} + {if $c13y.show_correction_fct} + {'c13y_Automatic_correction'|@translate} + {/if} + {if $c13y.show_correction_bad_fct} + {'c13y_Impossible_automatic_correction'|@translate} + {/if} + {if $c13y.show_correction_success_fct} + {'c13y_Correction_applied_success'|@translate} + {/if} + {if !empty($c13y.correction_error_fct)} + {'c13y_Correction_applied_error'|@translate} + <br /> + {$c13y.c13y.correction_error_fct} + {/if} + {if !empty($c13y.correction_msg)} + {if $c13y.show_correction_success_fct or !empty($c13y.correction_error_fct) or $c13y.show_correction_fct or $c13y.show_correction_bad_fct } + <br /> + {/if} + {$c13y.correction_msg|@nl2br} + {/if} + </label> + </td> + </tr> + {/foreach} + {/if} </table> <p> - <!-- BEGIN c13y_link_check_uncheck --> - <a href="#" onclick="SelectAll(document.getElementById('c13y')); return false;">{lang:c13y_check_all}</a> - / <a href="#" onclick="DeselectAll(document.getElementById('c13y')); return false;">{lang:c13y_uncheck_all}</a> - <!-- END c13y_link_check_uncheck --> - <!-- BEGIN c13y_link_check_automatic_correction --> - / <a href="#" onclick="DeselectAll(document.getElementById('c13y')); - <!-- BEGIN c13y_do_check --> - document.getElementById('c13y_selection-{c13y_link_check_automatic_correction.c13y_do_check.ID}').checked = true; - <!-- END c13y_do_check --> - return false;">{lang:c13y_check_auto}</a> - <!-- END c13y_link_check_automatic_correction --> + {if $c13y_show_submit_ignore} + <a href="#" onclick="SelectAll(document.getElementById('c13y')); return false;">{'c13y_check_all'|@translate}</a> + / <a href="#" onclick="DeselectAll(document.getElementById('c13y')); return false;">{'c13y_uncheck_all'|@translate}</a> + {/if} + {if isset($c13y_do_check)} + / <a href="#" onclick="DeselectAll(document.getElementById('c13y')); + {foreach from=$c13y_do_check item=ID} + document.getElementById('c13y_selection-{$ID}').checked = true; + {/foreach} + return false;">{'c13y_check_auto'|@translate}</a> + {/if} </p> <p> - <!-- BEGIN c13y_submit_automatic_correction --> - <input class="submit" type="submit" value="{lang:c13y_submit_correction}" name="c13y_submit_correction" {TAG_INPUT_ENABLED} /> - <!-- END c13y_submit_automatic_correction --> - <!-- BEGIN c13y_submit_ignore --> - <input class="submit" type="submit" value="{lang:c13y_submit_ignore}" name="c13y_submit_ignore" {TAG_INPUT_ENABLED} /> - <!-- END c13y_submit_ignore --> - <input class="submit" type="submit" value="{lang:c13y_submit_refresh}" name="c13y_submit_refresh" /> - </p> + {if $c13y_show_submit_automatic_correction} + <input class="submit" type="submit" value="{'c13y_submit_correction'|@translate}" name="c13y_submit_correction" {$TAG_INPUT_ENABLED} /> + {/if} + {if $c13y_show_submit_ignore} + <input class="submit" type="submit" value="{'c13y_submit_ignore'|@translate}" name="c13y_submit_ignore" {$TAG_INPUT_ENABLED} /> + {/if} + <input class="submit" type="submit" value="{'c13y_submit_refresh'|@translate}" name="c13y_submit_refresh" /> + </p> </fieldset> </form> |