aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/site_update.php136
-rw-r--r--template/yoga/admin/site_update.tpl111
2 files changed, 101 insertions, 146 deletions
diff --git a/admin/site_update.php b/admin/site_update.php
index a8dc0f5b4..7c7f25113 100644
--- a/admin/site_update.php
+++ b/admin/site_update.php
@@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
-// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
@@ -351,9 +351,9 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_id
$counts['del_categories'] = count($to_delete);
}
- $template->output .= '<!-- scanning dirs : '
+ $template->append('footer_elements', '<!-- scanning dirs : '
. get_elapsed_time($start, get_moment())
- . ' -->'."\n";
+ . ' -->' );
}
// +-----------------------------------------------------------------------+
// | files / elements |
@@ -365,9 +365,9 @@ if (isset($_POST['submit']) and $_POST['sync'] == 'files'
$start= $start_files;
$fs = $site_reader->get_elements($basedir);
- $template->output .= '<!-- get_elements: '
+ $template->append('footer_elements', '<!-- get_elements: '
. get_elapsed_time($start, get_moment())
- . " -->\n";
+ . ' -->' );
$cat_ids = array_diff(array_keys($db_categories), $to_delete);
@@ -581,9 +581,9 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id
$counts['del_elements'] = count($to_delete_elements);
}
- $template->output .= '<!-- scanning files : '
+ $template->append('footer_elements', '<!-- scanning files : '
. get_elapsed_time($start_files, get_moment())
- . ' -->'."\n";
+ . ' -->' );
// retrieving informations given by uploaders
if (!$simulate and count($cat_ids) > 0)
@@ -653,15 +653,15 @@ if (isset($_POST['submit'])
{
$start = get_moment();
update_category('all');
- $template->output .= '<!-- update_category(all) : '
+ $template->append('footer_elements', '<!-- update_category(all) : '
. get_elapsed_time($start,get_moment())
- . ' -->'."\n";
+ . ' -->' );
$start = get_moment();
ordering();
update_global_rank();
- $template->output .= '<!-- ordering categories : '
+ $template->append('footer_elements', '<!-- ordering categories : '
. get_elapsed_time($start, get_moment())
- . ' -->'."\n";
+ . ' -->');
}
if ($_POST['sync'] == 'files')
@@ -680,9 +680,9 @@ if (isset($_POST['submit'])
$files = get_filelist($opts['category_id'], $site_id,
$opts['recursive'],
false);
- $template->output .= '<!-- get_filelist : '
+ $template->append('footer_elements', '<!-- get_filelist : '
. get_elapsed_time($start, get_moment())
- . ' -->'."\n";
+ . ' -->');
$start = get_moment();
$datas = array();
@@ -726,9 +726,9 @@ if (isset($_POST['submit'])
$datas
);
}
- $template->output .= '<!-- update files : '
+ $template->append('footer_elements', '<!-- update files : '
. get_elapsed_time($start,get_moment())
- . ' -->'."\n";
+ . ' -->');
}// end if sync files
}
@@ -738,7 +738,7 @@ if (isset($_POST['submit'])
if (isset($_POST['submit'])
and ($_POST['sync'] == 'dirs' or $_POST['sync'] == 'files'))
{
- $template->assign_block_vars(
+ $template->assign(
'update_result',
array(
'NB_NEW_CATEGORIES'=>$counts['new_categories'],
@@ -782,9 +782,9 @@ if (isset($_POST['submit']) and preg_match('/^metadata/', $_POST['sync'])
$opts['recursive'],
$opts['only_new']);
- $template->output .= '<!-- get_filelist : '
+ $template->append('footer_elements', '<!-- get_filelist : '
. get_elapsed_time($start, get_moment())
- . ' -->'."\n";
+ . ' -->');
$start = get_moment();
$datas = array();
@@ -879,11 +879,11 @@ SELECT id
set_tags_of($tags_of);
}
- $template->output .= '<!-- metadata update : '
+ $template->append('footer_elements', '<!-- metadata update : '
. get_elapsed_time($start, get_moment())
- . ' -->'."\n";
+ . ' -->');
- $template->assign_block_vars(
+ $template->assign(
'metadata_result',
array(
'NB_ELEMENTS_DONE' => count($datas),
@@ -910,74 +910,29 @@ if ($site_is_remote and !isset($_POST['submit']) )
$used_metadata.= ' + ...';
}
-$template->assign_vars(
+$template->assign(
array(
'SITE_URL'=>$site_url,
- 'U_SITE_MANAGER'=> PHPWG_ROOT_PATH.'admin.php?page=site_manager',
+ 'U_SITE_MANAGER'=> get_root_url().'admin.php?page=site_manager',
'L_RESULT_UPDATE'=>$result_title.l10n('update_part_research'),
'L_RESULT_METADATA'=>$result_title.l10n('update_result_metadata'),
- 'METADATA_LIST' => $used_metadata
+ 'METADATA_LIST' => $used_metadata,
+ 'U_HELP' => get_root_url().'popuphelp.php?page=synchronize',
));
-$template->assign_vars(
- array(
- 'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=synchronize'
- )
- );
// +-----------------------------------------------------------------------+
// | introduction : choices |
// +-----------------------------------------------------------------------+
if (!isset($_POST['submit']) or (isset($simulate) and $simulate))
{
- $template->assign_block_vars('introduction', array());
-
if (isset($simulate) and $simulate)
{
- switch ($_POST['sync'])
- {
- case 'dirs' :
- {
- $template->assign_vars(
- array('SYNC_DIRS_CHECKED'=>'checked="checked"'));
- break;
- }
- case 'files' :
- {
- $template->assign_vars(
- array('SYNC_ALL_CHECKED'=>'checked="checked"'));
- break;
- }
- case 'metadata_new' :
- {
- $template->assign_vars(
- array('SYNC_META_NEW_CHECKED'=>'checked="checked"'));
- break;
- }
- case 'metadata_all' :
- {
- $template->assign_vars(
- array('SYNC_META_ALL_CHECKED'=>'checked="checked"'));
- break;
- }
- }
-
- if (isset($_POST['display_info']) and $_POST['display_info'] == 1)
- {
- $template->assign_vars(
- array('DISPLAY_INFO_CHECKED'=>'checked="checked"'));
- }
-
- if (isset($_POST['add_to_caddie']) and $_POST['add_to_caddie'] == 1)
- {
- $template->assign_vars(
- array('ADD_TO_CADDIE_CHECKED'=>'checked="checked"'));
- }
-
- if (isset($_POST['subcats-included']) and $_POST['subcats-included'] == 1)
- {
- $template->assign_vars(
- array('SUBCATS_INCLUDED_CHECKED'=>'checked="checked"'));
- }
+ $tpl_introduction = array(
+ 'sync' => $_POST['sync'],
+ 'display_info' => isset($_POST['display_info']) and $_POST['display_info']==1,
+ 'add_to_caddie' => isset($_POST['add_to_caddie']) and $_POST['add_to_caddie']==1,
+ 'subcats_included' => isset($_POST['subcats-included']) and $_POST['subcats-included']==1,
+ );
if (isset($_POST['cat']) and is_numeric($_POST['cat']))
{
@@ -990,13 +945,18 @@ if (!isset($_POST['submit']) or (isset($simulate) and $simulate))
}
else
{
- $template->assign_vars(
- array('SYNC_DIRS_CHECKED' => 'checked="checked"',
- 'SUBCATS_INCLUDED_CHECKED'=>'checked="checked"'));
+ $tpl_introduction = array(
+ 'sync' => 'dirs',
+ 'display_info' => false,
+ 'add_to_caddie' => false,
+ 'subcats_included' => true,
+ );
$cat_selected = array();
}
+ $template->assign('introduction', $tpl_introduction);
+
$query = '
SELECT id,name,uppercats,global_rank
FROM '.CATEGORIES_TABLE.'
@@ -1004,17 +964,16 @@ SELECT id,name,uppercats,global_rank
;';
display_select_cat_wrapper($query,
$cat_selected,
- 'introduction.category_option',
+ 'category_options',
false);
}
if (count($errors) > 0)
{
- $template->assign_block_vars('sync_errors', array());
foreach ($errors as $error)
{
- $template->assign_block_vars(
- 'sync_errors.error',
+ $template->append(
+ 'sync_errors',
array(
'ELEMENT' => $error['path'],
'LABEL' => $error['type'].' ('.$error_labels[$error['type']][0].')'
@@ -1023,24 +982,23 @@ if (count($errors) > 0)
foreach ($error_labels as $error_type=>$error_description)
{
- $template->assign_block_vars(
- 'sync_errors.error_caption',
+ $template->append(
+ 'sync_error_captions',
array(
'TYPE' => $error_type,
'LABEL' => $error_description[1]
));
}
-
}
+
if (count($infos) > 0
and isset($_POST['display_info'])
and $_POST['display_info'] == 1)
{
- $template->assign_block_vars('sync_infos', array());
foreach ($infos as $info)
{
- $template->assign_block_vars(
- 'sync_infos.info',
+ $template->append(
+ 'sync_infos',
array(
'ELEMENT' => $info['path'],
'LABEL' => $info['info']
diff --git a/template/yoga/admin/site_update.tpl b/template/yoga/admin/site_update.tpl
index a2aff3b59..98f797c96 100644
--- a/template/yoga/admin/site_update.tpl
+++ b/template/yoga/admin/site_update.tpl
@@ -1,111 +1,108 @@
-<!-- DEV TAG: not smarty migrated -->
-<!-- $Id$ -->
+{* $Id$ *}
<div class="titrePage">
<ul class="categoryActions">
- <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>
+ <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>
</ul>
- <h2>{lang:title_update}: <a href="{SITE_URL}">{SITE_URL}</a></h2>
+ <h2>{'title_update'|@translate}: <a href="{$SITE_URL}">{$SITE_URL}</a></h2>
</div>
-<!-- BEGIN update_result -->
-<h3>{L_RESULT_UPDATE}</h3>
+{if isset($update_result)}
+<h3>{$L_RESULT_UPDATE}</h3>
<ul>
- <li class="update_summary_new">{update_result.NB_NEW_CATEGORIES} {lang:update_nb_new_categories}</li>
- <li class="update_summary_new">{update_result.NB_NEW_ELEMENTS} {lang:update_nb_new_elements}</li>
- <li class="update_summary_del">{update_result.NB_DEL_CATEGORIES} {lang:update_nb_del_categories}</li>
- <li class="update_summary_del">{update_result.NB_DEL_ELEMENTS} {lang:update_nb_del_elements}</li>
- <li>{update_result.NB_UPD_ELEMENTS} {lang:update_nb_upd_elements}</li>
- <li class="update_summary_err">{update_result.NB_ERRORS} {lang:update_nb_errors}</li>
+ <li class="update_summary_new">{$update_result.NB_NEW_CATEGORIES} {'update_nb_new_categories'|@translate}</li>
+ <li class="update_summary_new">{$update_result.NB_NEW_ELEMENTS} {'update_nb_new_elements'|@translate}</li>
+ <li class="update_summary_del">{$update_result.NB_DEL_CATEGORIES} {'update_nb_del_categories'|@translate}</li>
+ <li class="update_summary_del">{$update_result.NB_DEL_ELEMENTS} {'update_nb_del_elements'|@translate}</li>
+ <li>{$update_result.NB_UPD_ELEMENTS} {'update_nb_upd_elements'|@translate}</li>
+ <li class="update_summary_err">{$update_result.NB_ERRORS} {'update_nb_errors'|@translate}</li>
</ul>
-<!-- END update_result -->
+{/if}
-<!-- BEGIN metadata_result -->
-<h3>{L_RESULT_METADATA}</h3>
+{if isset($metadata_result)}
+<h3>{$L_RESULT_METADATA}</h3>
<ul>
- <li>{metadata_result.NB_ELEMENTS_DONE} {lang:update_nb_elements_metadata_sync}</li>
- <li>{metadata_result.NB_ELEMENTS_CANDIDATES} {lang:update_nb_elements_metadata_available}</li>
- <li>{lang:update_used_metadata} : {METADATA_LIST}</li>
+ <li>{$metadata_result.NB_ELEMENTS_DONE} {'update_nb_elements_metadata_sync'|@translate}</li>
+ <li>{$metadata_result.NB_ELEMENTS_CANDIDATES} {'update_nb_elements_metadata_available'|@translate}</li>
+ <li>{'update_used_metadata'|@translate} : {$METADATA_LIST}</li>
</ul>
-<!-- END metadata_result -->
+{/if}
-<!-- BEGIN sync_errors -->
-<h3>{lang:update_error_list_title}</h3>
+{if not empty($sync_errors)}
+<h3>{'update_error_list_title'|@translate}</h3>
<div class="errors">
<ul>
- <!-- BEGIN error -->
- <li>[{sync_errors.error.ELEMENT}] {sync_errors.error.LABEL}</li>
- <!-- END error -->
+ {foreach from=$sync_errors item=error}
+ <li>[{$error.ELEMENT}] {$error.LABEL}</li>
+ {/foreach}
</ul>
</div>
-<h3>{lang:update_errors_caption}</h3>
+<h3>{'update_errors_caption'|@translate}</h3>
<ul>
- <!-- BEGIN error_caption -->
- <li><strong>{sync_errors.error_caption.TYPE}</strong>: {sync_errors.error_caption.LABEL}</li>
- <!-- END error_caption -->
+ {foreach from=$sync_error_captions item=caption}
+ <li><strong>{$caption.TYPE}</strong>: {$caption.LABEL}</li>
+ {/foreach}
</ul>
-<!-- END sync_errors -->
+{/if}
-<!-- BEGIN sync_infos -->
-<h3>{lang:update_infos_title}</h3>
+{if not empty($sync_infos)}
+<h3>{'update_infos_title'|@translate}</h3>
<div class="infos">
<ul>
- <!-- BEGIN info -->
- <li>[{sync_infos.info.ELEMENT}] {sync_infos.info.LABEL}</li>
- <!-- END sync_infos -->
+ {foreach from=$sync_infos item=info}
+ <li>[{$info.ELEMENT}] {$info.LABEL}</li>
+ {/foreach}
</ul>
</div>
-<!-- END infos -->
+{/if}
-<!-- BEGIN introduction -->
-<h3>{lang:update_default_title}</h3>
-<form action="{F_ACTION}" method="post" id="update">
+{if isset($introduction)}
+<h3>{'update_default_title'|@translate}</h3>
+<form action="" method="post" id="update">
<fieldset id="syncFiles">
- <legend>{lang:update_sync_files}</legend>
+ <legend>{'update_sync_files'|@translate}</legend>
<ul>
- <li><label><input type="radio" name="sync" value="dirs" {SYNC_DIRS_CHECKED} /> {lang:update_sync_dirs}</label></li>
- <li><label><input type="radio" name="sync" value="files" {SYNC_ALL_CHECKED} /> {lang:update_sync_all}</label></li>
- <li><label><input type="checkbox" name="display_info" value="1" {DISPLAY_INFO_CHECKED} /> {lang:update_display_info}</label></li>
- <li><label><input type="checkbox" name="add_to_caddie" value="1" {ADD_TO_CADDIE_CHECKED} /> {lang:add new elements to caddie}</label></li>
+ <li><label><input type="radio" name="sync" value="dirs" {if 'dirs'==$introduction.sync}checked="checked"{/if}/> {'update_sync_dirs'|@translate}</label></li>
+ <li><label><input type="radio" name="sync" value="files" {if 'files'==$introduction.sync}checked="checked"{/if}/> {'update_sync_all'|@translate}</label></li>
+ <li><label><input type="checkbox" name="display_info" value="1" {if $introduction.display_info}checked="checked"{/if}/> {'update_display_info'|@translate}</label></li>
+ <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>
</ul>
</fieldset>
<fieldset id="syncMetadata">
- <legend>{lang:update_sync_metadata}</legend>
- {lang:update_used_metadata} : {METADATA_LIST}.<br/>
+ <legend>{'update_sync_metadata'|@translate}</legend>
+ {'update_used_metadata'|@translate} : {$METADATA_LIST}.<br/>
<ul>
- <li><label><input type="radio" name="sync" value="metadata_new" {SYNC_META_NEW_CHECKED} /> {lang:update_sync_metadata_new}</label></li>
- <li><label><input type="radio" name="sync" value="metadata_all" {SYNC_META_ALL_CHECKED} /> {lang:update_sync_metadata_all}</label></li>
+ <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>
+ <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>
</ul>
</fieldset>
<fieldset id="syncSimulate">
<legend></legend>
- <ul><li><label><input type="checkbox" name="simulate" value="1" checked="checked" {TAG_INPUT_ENABLED} /> {lang:update_simulate}</label></li></ul>
+ <ul><li><label><input type="checkbox" name="simulate" value="1" checked="checked" {$TAG_INPUT_ENABLED} /> {'update_simulate'|@translate}</label></li></ul>
</fieldset>
<fieldset id="catSubset">
- <legend>{lang:update_cats_subset}</legend>
+ <legend>{'update_cats_subset'|@translate}</legend>
<ul>
<li>
<select class="categoryList" name="cat" size="10">
- <!-- BEGIN category_option -->
- <option {introduction.category_option.SELECTED} value="{introduction.category_option.VALUE}">{introduction.category_option.OPTION}</option>
- <!-- END category_option -->
+ {html_options options=$category_options selected=$category_options_selected}
</select>
</li>
- <li><label><input type="checkbox" name="subcats-included" value="1" {SUBCATS_INCLUDED_CHECKED} /> {lang:search_subcats_included}</label></li>
+ <li><label><input type="checkbox" name="subcats-included" value="1" {if $introduction.subcats_included}checked="checked"{/if}/> {'search_subcats_included'|@translate}</label></li>
</ul>
</fieldset>
<p class="bottomButtons">
- <input class="submit" type="submit" value="{lang:submit}" name="submit" />
- <input class="submit" type="reset" value="{lang:reset}" name="reset" />
+ <input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" />
+ <input class="submit" type="reset" value="{'Reset'|@translate}" name="reset" />
</p>
</form>
-<!-- END introduction -->
+{/if}{*isset $introduction*}
-<a href="{U_SITE_MANAGER}">{lang:Site manager}</a>
+<p><a href="{$U_SITE_MANAGER}">{'Site manager'|@translate}</a></p>