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

site_update goes smarty

File:
1 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'],
Note: See TracChangeset for help on using the changeset viewer.