Changeset 2276


Ignore:
Timestamp:
Mar 12, 2008, 2:06:50 AM (16 years ago)
Author:
rvelices
Message:

site_update goes smarty

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/site_update.php

    r2114 r2276  
    33// | PhpWebGallery - a PHP based picture gallery                           |
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    5 // | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
     5// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    77// | file          : $Id$
     
    352352  }
    353353
    354   $template->output .= '<!-- scanning dirs : '
     354  $template->append('footer_elements', '<!-- scanning dirs : '
    355355    . get_elapsed_time($start, get_moment())
    356     . ' -->'."\n";
     356    . ' -->' );
    357357}
    358358// +-----------------------------------------------------------------------+
     
    366366
    367367  $fs = $site_reader->get_elements($basedir);
    368   $template->output .= '<!-- get_elements: '
     368  $template->append('footer_elements', '<!-- get_elements: '
    369369    . get_elapsed_time($start, get_moment())
    370     . " -->\n";
     370    . ' -->' );
    371371
    372372  $cat_ids = array_diff(array_keys($db_categories), $to_delete);
     
    582582  }
    583583
    584   $template->output .= '<!-- scanning files : '
     584  $template->append('footer_elements', '<!-- scanning files : '
    585585    . get_elapsed_time($start_files, get_moment())
    586     . ' -->'."\n";
     586    . ' -->' );
    587587
    588588  // retrieving informations given by uploaders
     
    654654    $start = get_moment();
    655655    update_category('all');
    656     $template->output .= '<!-- update_category(all) : '
     656    $template->append('footer_elements', '<!-- update_category(all) : '
    657657      . get_elapsed_time($start,get_moment())
    658       . ' -->'."\n";
     658      . ' -->' );
    659659    $start = get_moment();
    660660    ordering();
    661661    update_global_rank();
    662     $template->output .= '<!-- ordering categories : '
     662    $template->append('footer_elements', '<!-- ordering categories : '
    663663      . get_elapsed_time($start, get_moment())
    664       . ' -->'."\n";
     664      . ' -->');
    665665  }
    666666
     
    681681                          $opts['recursive'],
    682682                          false);
    683     $template->output .= '<!-- get_filelist : '
     683    $template->append('footer_elements', '<!-- get_filelist : '
    684684      . get_elapsed_time($start, get_moment())
    685       . ' -->'."\n";
     685      . ' -->');
    686686    $start = get_moment();
    687687
     
    727727        );
    728728    }
    729     $template->output .= '<!-- update files : '
     729    $template->append('footer_elements', '<!-- update files : '
    730730      . get_elapsed_time($start,get_moment())
    731       . ' -->'."\n";
     731      . ' -->');
    732732  }// end if sync files
    733733}
     
    739739    and ($_POST['sync'] == 'dirs' or $_POST['sync'] == 'files'))
    740740{
    741   $template->assign_block_vars(
     741  $template->assign(
    742742    'update_result',
    743743    array(
     
    783783                        $opts['only_new']);
    784784
    785   $template->output .= '<!-- get_filelist : '
     785  $template->append('footer_elements', '<!-- get_filelist : '
    786786    . get_elapsed_time($start, get_moment())
    787     . ' -->'."\n";
     787    . ' -->');
    788788
    789789  $start = get_moment();
     
    880880  }
    881881
    882   $template->output .= '<!-- metadata update : '
     882  $template->append('footer_elements', '<!-- metadata update : '
    883883    . get_elapsed_time($start, get_moment())
    884     . ' -->'."\n";
    885 
    886   $template->assign_block_vars(
     884    . ' -->');
     885
     886  $template->assign(
    887887    'metadata_result',
    888888    array(
     
    911911}
    912912
    913 $template->assign_vars(
     913$template->assign(
    914914  array(
    915915    'SITE_URL'=>$site_url,
    916     'U_SITE_MANAGER'=> PHPWG_ROOT_PATH.'admin.php?page=site_manager',
     916    'U_SITE_MANAGER'=> get_root_url().'admin.php?page=site_manager',
    917917    'L_RESULT_UPDATE'=>$result_title.l10n('update_part_research'),
    918918    'L_RESULT_METADATA'=>$result_title.l10n('update_result_metadata'),
    919     'METADATA_LIST' => $used_metadata
     919    'METADATA_LIST' => $used_metadata,
     920    'U_HELP' => get_root_url().'popuphelp.php?page=synchronize',
    920921    ));
    921922
    922 $template->assign_vars(
    923   array(
    924     'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=synchronize'
    925     )
    926   );
    927923// +-----------------------------------------------------------------------+
    928924// |                        introduction : choices                         |
     
    930926if (!isset($_POST['submit']) or (isset($simulate) and $simulate))
    931927{
    932   $template->assign_block_vars('introduction', array());
    933 
    934928  if (isset($simulate) and $simulate)
    935929  {
    936     switch ($_POST['sync'])
    937     {
    938       case 'dirs' :
    939       {
    940         $template->assign_vars(
    941           array('SYNC_DIRS_CHECKED'=>'checked="checked"'));
    942         break;
    943       }
    944       case 'files' :
    945       {
    946         $template->assign_vars(
    947           array('SYNC_ALL_CHECKED'=>'checked="checked"'));
    948         break;
    949       }
    950       case 'metadata_new' :
    951       {
    952         $template->assign_vars(
    953           array('SYNC_META_NEW_CHECKED'=>'checked="checked"'));
    954         break;
    955       }
    956       case 'metadata_all' :
    957       {
    958         $template->assign_vars(
    959           array('SYNC_META_ALL_CHECKED'=>'checked="checked"'));
    960         break;
    961       }
    962     }
    963 
    964     if (isset($_POST['display_info']) and $_POST['display_info'] == 1)
    965     {
    966       $template->assign_vars(
    967         array('DISPLAY_INFO_CHECKED'=>'checked="checked"'));
    968     }
    969 
    970     if (isset($_POST['add_to_caddie']) and $_POST['add_to_caddie'] == 1)
    971     {
    972       $template->assign_vars(
    973         array('ADD_TO_CADDIE_CHECKED'=>'checked="checked"'));
    974     }
    975 
    976     if (isset($_POST['subcats-included']) and $_POST['subcats-included'] == 1)
    977     {
    978       $template->assign_vars(
    979         array('SUBCATS_INCLUDED_CHECKED'=>'checked="checked"'));
    980     }
     930    $tpl_introduction = array(
     931        'sync'  => $_POST['sync'],
     932        'display_info' => isset($_POST['display_info']) and $_POST['display_info']==1,
     933        'add_to_caddie' => isset($_POST['add_to_caddie']) and $_POST['add_to_caddie']==1,
     934        'subcats_included' => isset($_POST['subcats-included']) and $_POST['subcats-included']==1,
     935      );
    981936
    982937    if (isset($_POST['cat']) and is_numeric($_POST['cat']))
     
    991946  else
    992947  {
    993     $template->assign_vars(
    994       array('SYNC_DIRS_CHECKED' => 'checked="checked"',
    995             'SUBCATS_INCLUDED_CHECKED'=>'checked="checked"'));
     948    $tpl_introduction = array(
     949        'sync'  => 'dirs',
     950        'display_info' => false,
     951        'add_to_caddie' => false,
     952        'subcats_included' => true,
     953      );
    996954
    997955    $cat_selected = array();
    998956  }
     957
     958  $template->assign('introduction', $tpl_introduction);
    999959
    1000960  $query = '
     
    1005965  display_select_cat_wrapper($query,
    1006966                             $cat_selected,
    1007                              'introduction.category_option',
     967                             'category_options',
    1008968                             false);
    1009969}
     
    1011971if (count($errors) > 0)
    1012972{
    1013   $template->assign_block_vars('sync_errors', array());
    1014973  foreach ($errors as $error)
    1015974  {
    1016     $template->assign_block_vars(
    1017       'sync_errors.error',
     975    $template->append(
     976      'sync_errors',
    1018977      array(
    1019978        'ELEMENT' => $error['path'],
     
    1024983  foreach ($error_labels as $error_type=>$error_description)
    1025984  {
    1026     $template->assign_block_vars(
    1027       'sync_errors.error_caption',
     985    $template->append(
     986      'sync_error_captions',
    1028987      array(
    1029988        'TYPE' => $error_type,
     
    1031990        ));
    1032991  }
    1033 
    1034 }
     992}
     993
    1035994if (count($infos) > 0
    1036995    and isset($_POST['display_info'])
    1037996    and $_POST['display_info'] == 1)
    1038997{
    1039   $template->assign_block_vars('sync_infos', array());
    1040998  foreach ($infos as $info)
    1041999  {
    1042     $template->assign_block_vars(
    1043       'sync_infos.info',
     1000    $template->append(
     1001      'sync_infos',
    10441002      array(
    10451003        'ELEMENT' => $info['path'],
  • trunk/template/yoga/admin/site_update.tpl

    r2222 r2276  
    1 <!-- DEV TAG: not smarty migrated -->
    2 <!-- $Id$ -->
     1{* $Id$ *}
    32
    43<div class="titrePage">
    54  <ul class="categoryActions">
    6     <li><a href="{U_HELP}" onclick="popuphelp(this.href); return false;" title="{lang:Help}"><img src="{themeconf:icon_dir}/help.png" class="button" alt="(?)"></a></li>
     5    <li><a href="{$U_HELP}" onclick="popuphelp(this.href); return false;" title="{'Help'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/help.png" class="button" alt="(?)"></a></li>
    76  </ul>
    8   <h2>{lang:title_update}: <a href="{SITE_URL}">{SITE_URL}</a></h2>
     7  <h2>{'title_update'|@translate}: <a href="{$SITE_URL}">{$SITE_URL}</a></h2>
    98</div>
    109
    11 <!-- BEGIN update_result -->
    12 <h3>{L_RESULT_UPDATE}</h3>
     10{if isset($update_result)}
     11<h3>{$L_RESULT_UPDATE}</h3>
    1312<ul>
    14   <li class="update_summary_new">{update_result.NB_NEW_CATEGORIES} {lang:update_nb_new_categories}</li>
    15   <li class="update_summary_new">{update_result.NB_NEW_ELEMENTS} {lang:update_nb_new_elements}</li>
    16   <li class="update_summary_del">{update_result.NB_DEL_CATEGORIES} {lang:update_nb_del_categories}</li>
    17   <li class="update_summary_del">{update_result.NB_DEL_ELEMENTS} {lang:update_nb_del_elements}</li>
    18   <li>{update_result.NB_UPD_ELEMENTS} {lang:update_nb_upd_elements}</li>
    19   <li class="update_summary_err">{update_result.NB_ERRORS} {lang:update_nb_errors}</li>
     13  <li class="update_summary_new">{$update_result.NB_NEW_CATEGORIES} {'update_nb_new_categories'|@translate}</li>
     14  <li class="update_summary_new">{$update_result.NB_NEW_ELEMENTS} {'update_nb_new_elements'|@translate}</li>
     15  <li class="update_summary_del">{$update_result.NB_DEL_CATEGORIES} {'update_nb_del_categories'|@translate}</li>
     16  <li class="update_summary_del">{$update_result.NB_DEL_ELEMENTS} {'update_nb_del_elements'|@translate}</li>
     17  <li>{$update_result.NB_UPD_ELEMENTS} {'update_nb_upd_elements'|@translate}</li>
     18  <li class="update_summary_err">{$update_result.NB_ERRORS} {'update_nb_errors'|@translate}</li>
    2019</ul>
    21 <!-- END update_result -->
     20{/if}
    2221
    23 <!-- BEGIN metadata_result -->
    24 <h3>{L_RESULT_METADATA}</h3>
     22{if isset($metadata_result)}
     23<h3>{$L_RESULT_METADATA}</h3>
    2524<ul>
    26   <li>{metadata_result.NB_ELEMENTS_DONE} {lang:update_nb_elements_metadata_sync}</li>
    27   <li>{metadata_result.NB_ELEMENTS_CANDIDATES} {lang:update_nb_elements_metadata_available}</li>
    28   <li>{lang:update_used_metadata} : {METADATA_LIST}</li>
     25  <li>{$metadata_result.NB_ELEMENTS_DONE} {'update_nb_elements_metadata_sync'|@translate}</li>
     26  <li>{$metadata_result.NB_ELEMENTS_CANDIDATES} {'update_nb_elements_metadata_available'|@translate}</li>
     27  <li>{'update_used_metadata'|@translate} : {$METADATA_LIST}</li>
    2928</ul>
    30 <!-- END metadata_result -->
     29{/if}
    3130
    3231
    33 <!-- BEGIN sync_errors -->
    34 <h3>{lang:update_error_list_title}</h3>
     32{if not empty($sync_errors)}
     33<h3>{'update_error_list_title'|@translate}</h3>
    3534<div class="errors">
    3635<ul>
    37   <!-- BEGIN error -->
    38   <li>[{sync_errors.error.ELEMENT}] {sync_errors.error.LABEL}</li>
    39   <!-- END error -->
     36  {foreach from=$sync_errors item=error}
     37  <li>[{$error.ELEMENT}] {$error.LABEL}</li>
     38  {/foreach}
    4039</ul>
    4140</div>
    42 <h3>{lang:update_errors_caption}</h3>
     41<h3>{'update_errors_caption'|@translate}</h3>
    4342<ul>
    44   <!-- BEGIN error_caption -->
    45   <li><strong>{sync_errors.error_caption.TYPE}</strong>: {sync_errors.error_caption.LABEL}</li>
    46   <!-- END error_caption -->
     43  {foreach from=$sync_error_captions item=caption}
     44  <li><strong>{$caption.TYPE}</strong>: {$caption.LABEL}</li>
     45  {/foreach}
    4746</ul>
    48 <!-- END sync_errors -->
     47{/if}
    4948
    50 <!-- BEGIN sync_infos -->
    51 <h3>{lang:update_infos_title}</h3>
     49{if not empty($sync_infos)}
     50<h3>{'update_infos_title'|@translate}</h3>
    5251<div class="infos">
    5352<ul>
    54   <!-- BEGIN info -->
    55   <li>[{sync_infos.info.ELEMENT}] {sync_infos.info.LABEL}</li>
    56   <!-- END sync_infos -->
     53  {foreach from=$sync_infos item=info}
     54  <li>[{$info.ELEMENT}] {$info.LABEL}</li>
     55  {/foreach}
    5756</ul>
    5857</div>
    59 <!-- END infos -->
     58{/if}
    6059
    61 <!-- BEGIN introduction -->
    62 <h3>{lang:update_default_title}</h3>
    63 <form action="{F_ACTION}" method="post" id="update">
     60{if isset($introduction)}
     61<h3>{'update_default_title'|@translate}</h3>
     62<form action="" method="post" id="update">
    6463
    6564  <fieldset id="syncFiles">
    66     <legend>{lang:update_sync_files}</legend>
     65    <legend>{'update_sync_files'|@translate}</legend>
    6766    <ul>
    68       <li><label><input type="radio" name="sync" value="dirs" {SYNC_DIRS_CHECKED} /> {lang:update_sync_dirs}</label></li>
    69       <li><label><input type="radio" name="sync" value="files" {SYNC_ALL_CHECKED} /> {lang:update_sync_all}</label></li>
    70       <li><label><input type="checkbox" name="display_info" value="1" {DISPLAY_INFO_CHECKED} /> {lang:update_display_info}</label></li>
    71       <li><label><input type="checkbox" name="add_to_caddie" value="1" {ADD_TO_CADDIE_CHECKED} /> {lang:add new elements to caddie}</label></li>
     67      <li><label><input type="radio" name="sync" value="dirs" {if 'dirs'==$introduction.sync}checked="checked"{/if}/> {'update_sync_dirs'|@translate}</label></li>
     68      <li><label><input type="radio" name="sync" value="files" {if 'files'==$introduction.sync}checked="checked"{/if}/> {'update_sync_all'|@translate}</label></li>
     69      <li><label><input type="checkbox" name="display_info" value="1" {if $introduction.display_info}checked="checked"{/if}/> {'update_display_info'|@translate}</label></li>
     70      <li><label><input type="checkbox" name="add_to_caddie" value="1" {if $introduction.add_to_caddie}checked="checked"{/if}/> {'add new elements to caddie'|@translate}</label></li>
    7271    </ul>
    7372  </fieldset>
    7473
    7574  <fieldset id="syncMetadata">
    76     <legend>{lang:update_sync_metadata}</legend>
    77     {lang:update_used_metadata} : {METADATA_LIST}.<br/>
     75    <legend>{'update_sync_metadata'|@translate}</legend>
     76    {'update_used_metadata'|@translate} : {$METADATA_LIST}.<br/>
    7877    <ul>
    79       <li><label><input type="radio" name="sync" value="metadata_new" {SYNC_META_NEW_CHECKED} /> {lang:update_sync_metadata_new}</label></li>
    80       <li><label><input type="radio" name="sync" value="metadata_all" {SYNC_META_ALL_CHECKED} /> {lang:update_sync_metadata_all}</label></li>
     78      <li><label><input type="radio" name="sync" value="metadata_new" {if 'metadata_new'==$introduction.sync}checked="checked"{/if}/> {'update_sync_metadata_new'|@translate}</label></li>
     79      <li><label><input type="radio" name="sync" value="metadata_all" {if 'metadata_all'==$introduction.sync}checked="checked"{/if}/> {'update_sync_metadata_all'|@translate}</label></li>
    8180    </ul>
    8281  </fieldset>
     
    8483  <fieldset id="syncSimulate">
    8584    <legend></legend>
    86     <ul><li><label><input type="checkbox" name="simulate" value="1" checked="checked" {TAG_INPUT_ENABLED} /> {lang:update_simulate}</label></li></ul>
     85    <ul><li><label><input type="checkbox" name="simulate" value="1" checked="checked" {$TAG_INPUT_ENABLED} /> {'update_simulate'|@translate}</label></li></ul>
    8786  </fieldset>
    8887
    8988  <fieldset id="catSubset">
    90     <legend>{lang:update_cats_subset}</legend>
     89    <legend>{'update_cats_subset'|@translate}</legend>
    9190    <ul>
    9291    <li>
    9392    <select class="categoryList" name="cat" size="10">
    94       <!-- BEGIN category_option -->
    95       <option {introduction.category_option.SELECTED} value="{introduction.category_option.VALUE}">{introduction.category_option.OPTION}</option>
    96       <!-- END category_option -->
     93      {html_options options=$category_options selected=$category_options_selected}
    9794    </select>
    9895    </li>
    9996
    100     <li><label><input type="checkbox" name="subcats-included" value="1" {SUBCATS_INCLUDED_CHECKED} /> {lang:search_subcats_included}</label></li>
     97    <li><label><input type="checkbox" name="subcats-included" value="1" {if $introduction.subcats_included}checked="checked"{/if}/> {'search_subcats_included'|@translate}</label></li>
    10198    </ul>
    10299  </fieldset>
    103100
    104101  <p class="bottomButtons">
    105     <input class="submit" type="submit" value="{lang:submit}" name="submit" />
    106     <input class="submit" type="reset"  value="{lang:reset}"  name="reset"  />
     102    <input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" />
     103    <input class="submit" type="reset"  value="{'Reset'|@translate}"  name="reset"  />
    107104  </p>
    108105</form>
    109 <!-- END introduction -->
     106{/if}{*isset $introduction*}
    110107
    111 <a href="{U_SITE_MANAGER}">{lang:Site manager}</a>
     108<p><a href="{$U_SITE_MANAGER}">{'Site manager'|@translate}</a></p>
Note: See TracChangeset for help on using the changeset viewer.