aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2008-03-11 01:51:47 +0000
committerrvelices <rv-github@modusoptimus.com>2008-03-11 01:51:47 +0000
commit62e55bc595f682da05914cc2949454d58a05e368 (patch)
treee51f710bd79dea4a251caca41134d536d01107b5
parentff19a8f1cd624eae602b64895ce92bdaa7789d69 (diff)
group_list, group_perm and site_manager go smarty
git-svn-id: http://piwigo.org/svn/trunk@2273 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/group_list.php16
-rw-r--r--admin/group_perm.php10
-rw-r--r--admin/site_manager.php82
-rw-r--r--template/yoga/admin/group_list.tpl45
-rw-r--r--template/yoga/admin/group_perm.tpl10
-rw-r--r--template/yoga/admin/site_manager.tpl92
6 files changed, 113 insertions, 142 deletions
diff --git a/admin/group_list.php b/admin/group_list.php
index 2d8bbfbee..c6a8ecf36 100644
--- a/admin/group_list.php
+++ b/admin/group_list.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$
@@ -154,10 +154,10 @@ UPDATE '.GROUPS_TABLE.'
$template->set_filenames(array('group_list' => 'admin/group_list.tpl'));
-$template->assign_vars(
+$template->assign(
array(
- 'F_ADD_ACTION' => PHPWG_ROOT_PATH.'admin.php?page=group_list',
- 'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=group_list',
+ 'F_ADD_ACTION' => get_root_url().'admin.php?page=group_list',
+ 'U_HELP' => get_root_url().'popuphelp.php?page=group_list',
)
);
@@ -172,13 +172,12 @@ SELECT id, name, is_default
;';
$result = pwg_query($query);
-$admin_url = PHPWG_ROOT_PATH.'admin.php?page=';
+$admin_url = get_root_url().'admin.php?page=';
$perm_url = $admin_url.'group_perm&amp;group_id=';
$del_url = $admin_url.'group_list&amp;delete=';
$members_url = $admin_url.'user_list&amp;group=';
$toggle_is_default_url = $admin_url.'group_list&amp;toggle_is_default=';
-$num = 0;
while ($row = mysql_fetch_array($result))
{
$query = '
@@ -188,10 +187,9 @@ SELECT COUNT(*)
;';
list($counter) = mysql_fetch_row(pwg_query($query));
- $template->assign_block_vars(
- 'group',
+ $template->append(
+ 'groups',
array(
- 'CLASS' => ($num++ % 2 == 1) ? 'row2' : 'row1',
'NAME' => $row['name'],
'IS_DEFAULT' => (get_boolean($row['is_default']) ? ' ['.l10n('is_default_group').']' : ''),
'MEMBERS' => l10n_dec('%d member', '%d members', $counter),
diff --git a/admin/group_perm.php b/admin/group_perm.php
index c73bfbdd6..27e0e9e38 100644
--- a/admin/group_perm.php
+++ b/admin/group_perm.php
@@ -2,10 +2,9 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
-// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
+// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
-// | branch : BSF (Best So Far)
-// | file : $RCSfile$
+// | file : $Id$
// | last update : $Date$
// | last modifier : $Author$
// | revision : $Revision$
@@ -132,7 +131,7 @@ $template->set_filenames(
)
);
-$template->assign_vars(
+$template->assign(
array(
'TITLE' =>
sprintf(
@@ -142,10 +141,9 @@ $template->assign_vars(
),
'L_CAT_OPTIONS_TRUE'=>l10n('authorized'),
'L_CAT_OPTIONS_FALSE'=>l10n('forbidden'),
- 'L_CAT_OPTIONS_INFO'=>l10n('permuser_info'),
'F_ACTION' =>
- PHPWG_ROOT_PATH.
+ get_root_url().
'admin.php?page=group_perm&amp;group_id='.
$page['group']
)
diff --git a/admin/site_manager.php b/admin/site_manager.php
index 6f848e782..7676c3091 100644
--- a/admin/site_manager.php
+++ b/admin/site_manager.php
@@ -2,10 +2,9 @@
// +-----------------------------------------------------------------------+
// | 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 |
// +-----------------------------------------------------------------------+
-// | branch : BSF (Best So Far)
-// | file : $RCSfile$
+// | file : $Id$
// | last update : $Date$
// | last modifier : $Author$
// | revision : $Revision$
@@ -50,15 +49,14 @@ function remote_output($url)
if($lines = @file($url))
{
- $template->assign_block_vars('remote_output', array());
// cleaning lines from HTML tags
foreach ($lines as $line)
{
$line = trim(strip_tags($line));
if (preg_match('/^PWG-([A-Z]+)-/', $line, $matches))
{
- $template->assign_block_vars(
- 'remote_output.remote_line',
+ $template->append(
+ 'remote_output',
array(
'CLASS' => 'remote'.ucfirst(strtolower($matches[1])),
'CONTENT' => $line
@@ -117,7 +115,7 @@ SELECT COUNT(id) AS count
$clf_url = $url.'create_listing_file.php';
$clf_url.= '?action=test';
$clf_url.= '&version='.PHPWG_VERSION;
- if ($lines = @file($clf_url))
+ if ( ($lines = @file($clf_url)) !== false)
{
$first_line = strip_tags($lines[0]);
if (!preg_match('/^PWG-INFO-2:/', $first_line))
@@ -176,21 +174,18 @@ SELECT galleries_url
case 'generate' :
{
$title = $galleries_url.' : '.l10n('remote_site_generate');
- $template->assign_vars(array('REMOTE_SITE_TITLE'=>$title));
remote_output($galleries_url.'create_listing_file.php?action=generate');
break;
}
case 'test' :
{
$title = $galleries_url.' : '.l10n('remote_site_test');
- $template->assign_vars(array('REMOTE_SITE_TITLE'=>$title));
remote_output($galleries_url.'create_listing_file.php?action=test&version='.PHPWG_VERSION);
break;
}
case 'clean' :
{
$title = $galleries_url.' : '.l10n('remote_site_clean');
- $template->assign_vars(array('REMOTE_SITE_TITLE'=>$title));
remote_output($galleries_url.'create_listing_file.php?action=clean');
break;
}
@@ -204,9 +199,9 @@ SELECT galleries_url
}
}
-$template->assign_vars( array(
- 'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=site_manager',
- 'F_ACTION' => PHPWG_ROOT_PATH.'admin.php'
+$template->assign( array(
+ 'U_HELP' => get_root_url().'popuphelp.php?page=site_manager',
+ 'F_ACTION' => get_root_url().'admin.php'
.get_query_string_diff( array('action','site') )
) );
@@ -235,10 +230,6 @@ SELECT s.*, COUNT(c.id) AS nb_categories, SUM(c.nb_images) AS nb_images
';';
$result = pwg_query($query);
-if (mysql_num_rows($result) > 0)
-{
- $template->assign_block_vars('sites', array());
-}
while ($row = mysql_fetch_array($result))
{
$is_remote = url_is_remote($row['galleries_url']);
@@ -250,78 +241,61 @@ while ($row = mysql_fetch_array($result))
$update_url = PHPWG_ROOT_PATH.'admin.php';
$update_url.= '?page=site_update';
$update_url.= '&amp;site='.$row['id'];
- $template->assign_block_vars(
- 'sites.site',
+
+ $tpl_var =
array(
'NAME' => $row['galleries_url'],
'TYPE' => l10n( $is_remote ? 'site_remote' : 'site_local' ),
'CATEGORIES' => $row['nb_categories'],
'IMAGES' => isset($row['nb_images']) ? $row['nb_images'] : 0,
'U_SYNCHRONIZE' => $update_url
- )
- );
+ );
+
if ($is_remote)
{
- $template->assign_block_vars('sites.site.remote',
+ $tpl_var['remote'] =
array(
'U_TEST' => $base_url.'test',
'U_GENERATE' => $row['galleries_url'].'create_listing_file.php?action=generate',
'U_CLEAN' => $base_url.'clean',
- )
- );
+ );
}
if ($row['id'] != 1)
{
- $template->assign_block_vars( 'sites.site.delete',
- array('U_DELETE' => $base_url.'delete') );
+ $tpl_var['U_DELETE'] = $base_url.'delete';
}
+ $plugin_links = array();
+ //$plugin_links is array of array composed of U_HREF, U_HINT & U_CAPTION
+ $plugin_links =
+ trigger_event('get_admins_site_links',
+ $plugin_links, $row['id'], $is_remote);
+ $tpl_var['plugin_links'] = $plugin_links;
+
+ $template->append('sites', $tpl_var);
+
if ( isset($local_listing_site_url) and
$row['galleries_url']==$local_listing_site_url )
{
$local_listing_site_id = $row['id'];
- $template->assign_block_vars( 'local_listing',
+ $template->assign( 'local_listing',
array(
'URL' => $local_listing_site_url,
+ 'U_SYNCHRONIZE' => $update_url.'&amp;local_listing=1'
)
);
-
- $template->assign_block_vars( 'local_listing.update',
- array(
- 'U_SYNCHRONIZE' => $update_url.'&amp;local_listing=1'
- )
- );
}
-
- $plugin_links = array();
- //$plugin_links is array of array composed of U_HREF, U_HINT & U_CAPTION
- $plugin_links =
- trigger_event('get_admins_site_links',
- $plugin_links, $row['id'], $is_remote);
-
- // plugin_links
- if (count($plugin_links) > 0)
- {
- foreach ($plugin_links as $plugin_link)
- {
- $template->assign_block_vars('sites.site.plugin_links.plugin_link', $plugin_link);
- }
- }
-
}
if ( isset($local_listing_site_url) and !isset($local_listing_site_id) )
{
- $template->assign_block_vars( 'local_listing',
+ $template->assign( 'local_listing',
array(
'URL' => $local_listing_site_url,
+ 'CREATE' => true
)
);
-
- $template->assign_block_vars( 'local_listing.create',
- array('NAME' => $local_listing_site_url)
- );
}
diff --git a/template/yoga/admin/group_list.tpl b/template/yoga/admin/group_list.tpl
index 013058911..274445f4b 100644
--- a/template/yoga/admin/group_list.tpl
+++ b/template/yoga/admin/group_list.tpl
@@ -1,45 +1,46 @@
-<!-- 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_groups}</h2>
+ <h2>{'title_groups'|@translate}</h2>
</div>
-<form method="post" name="add_user" action="{F_ADD_ACTION}" class="properties">
+<form method="post" name="add_user" action="{$F_ADD_ACTION}" class="properties">
<fieldset>
- <legend>{lang:Add group}</legend>
+ <legend>{'Add group'|@translate}</legend>
<span class="property">
- <label for="groupname">{lang:Group name}</label>
+ <label for="groupname">{'Group name'|@translate}</label>
</span>
<input type="text" id="groupname" name="groupname" maxlength="50" size="20" />
<p>
- <input class="submit" type="submit" name="submit_add" value="{lang:Add}" {TAG_INPUT_ENABLED}/>
+ <input class="submit" type="submit" name="submit_add" value="{'Add'|@translate}" {$TAG_INPUT_ENABLED}/>
</p>
</fieldset>
</form>
<table class="table2">
<tr class="throw">
- <th>{lang:Group name}</th>
- <th>{lang:Members}</th>
- <th>{lang:Actions}</th>
+ <th>{'Group name'|@translate}</th>
+ <th>{'Members'|@translate}</th>
+ <th>{'Actions'|@translate}</th>
</tr>
- <!-- BEGIN group -->
- <tr class="{group.CLASS}">
- <td>{group.NAME}<i><small>{group.IS_DEFAULT}</small></i></td>
- <td><a href="{group.U_MEMBERS}">{group.MEMBERS}</a></td>
+ {if not empty($groups)}
+ {foreach from=$groups item=group name=group_loop}
+ <tr class="{if $smarty.foreach.group_loop.index is odd}row1{else}row2{/if}">
+ <td>{$group.NAME}<i><small>{$group.IS_DEFAULT}</small></i></td>
+ <td><a href="{$group.U_MEMBERS}">{$group.MEMBERS}</a></td>
<td style="text-align:center;">
- <a href="{group.U_PERM}">
- <img src="{themeconf:icon_dir}/permissions.png" class="button" style="border:none" id="btn_permissions" alt="{lang:permissions}" title="{lang:permissions}" /></a>
- <a href="{group.U_DELETE}" onclick="return confirm('{lang:Action: }' + document.getElementById('btn_delete').title + '\n\n' + '{lang:Are you sure?}');">
- <img src="{themeconf:icon_dir}/delete.png" class="button" style="border:none" id="btn_delete" alt="{lang:delete}" title="{lang:delete}" {TAG_INPUT_ENABLED}/></a>
- <a href="{group.U_ISDEFAULT}" onclick="return confirm('{lang:Action: }' + document.getElementById('btn_toggle_is_default_group').title + '\n\n' + '{lang:Are you sure?}');">
- <img src="{themeconf:icon_dir}/toggle_is_default_group.png" class="button" style="border:none" id="btn_toggle_is_default_group" alt="{lang:toggle_is_default_group}" title="{lang:toggle_is_default_group}" {TAG_INPUT_ENABLED}/></a>
+ <a href="{$group.U_PERM}">
+ <img src="{$ROOT_URL}{$themeconf.icon_dir}/permissions.png" class="button" style="border:none" id="btn_permissions" alt="{'permissions'|@translate}" title="{'permissions'|@translate}" /></a>
+ <a href="{$group.U_DELETE}" onclick="return confirm( document.getElementById('btn_delete').title + '\n\n' + '{'Are you sure?'|@translate|@escape:'javascript'}');">
+ <img src="{$ROOT_URL}{$themeconf.icon_dir}/delete.png" class="button" style="border:none" id="btn_delete" alt="{'delete'|@translate}" title="{'delete'|@translate}" {$TAG_INPUT_ENABLED}/></a>
+ <a href="{$group.U_ISDEFAULT}" onclick="return confirm( document.getElementById('btn_toggle_is_default_group').title + '\n\n' + '{'Are you sure?'|@translate|@escape:'javascript'}');">
+ <img src="{$ROOT_URL}{$themeconf.icon_dir}/toggle_is_default_group.png" class="button" style="border:none" id="btn_toggle_is_default_group" alt="{'toggle_is_default_group'|@translate}" title="{'toggle_is_default_group'|@translate}" {$TAG_INPUT_ENABLED}/></a>
</td>
</tr>
- <!-- END group -->
+ {/foreach}
+ {/if}
</table>
diff --git a/template/yoga/admin/group_perm.tpl b/template/yoga/admin/group_perm.tpl
index 938c9f1d6..1dded1291 100644
--- a/template/yoga/admin/group_perm.tpl
+++ b/template/yoga/admin/group_perm.tpl
@@ -1,8 +1,8 @@
-<!-- DEV TAG: not smarty migrated -->
-<h2>{TITLE}</h2>
+{* $Id *}
+<h2>{$TITLE}</h2>
-<form method="post" action="{F_ACTION}">
- {DOUBLE_SELECT}
+<form method="post" action="{$F_ACTION}">
+ {$DOUBLE_SELECT}
</form>
-<p>{lang:Only private categories are listed}</p>
+<p>{'Only private categories are listed'|@translate}</p>
diff --git a/template/yoga/admin/site_manager.tpl b/template/yoga/admin/site_manager.tpl
index d737bd019..627181c5a 100644
--- a/template/yoga/admin/site_manager.tpl
+++ b/template/yoga/admin/site_manager.tpl
@@ -1,73 +1,73 @@
-<!-- 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:Site manager}</h2>
+ <h2>{'Site manager'|@translate}</h2>
</div>
-<!-- BEGIN remote_output -->
+{if not empty($remote_output)}
<div class="remoteOutput">
<ul>
- <!-- BEGIN remote_line -->
- <li class="{remote_output.remote_line.CLASS}">{remote_output.remote_line.CONTENT}</li>
- <!-- END remote_line -->
+ {foreach from=$remote_output item=remote_line}
+ <li class="{$remote_line.CLASS}">{$remote_line.CONTENT}</li>
+ {/foreach}
</ul>
</div>
-<!-- END remote_output -->
+{/if}
-<!-- BEGIN local_listing -->
-{lang:remote_site_local_found} {local_listing.URL}
-<!-- BEGIN create -->
-<form action="" method="post">
+{if isset($local_listing)}
+{'remote_site_local_found'|@translate} {$local_listing.URL}
+{if isset($local_listing.CREATE)}
+<form action="{$F_ACTION}" method="post">
<p>
- {lang:remote_site_local_create}:
+ {'remote_site_local_create'|@translate}:
<input type="hidden" name="no_check" value="1"/>
- <input type="hidden" name="galleries_url" value="{local_listing.URL}" />
- <input type="submit" name="submit" value="{lang:submit}" {TAG_INPUT_ENABLED} />
+ <input type="hidden" name="galleries_url" value="{$local_listing.URL}" />
+ <input type="submit" name="submit" value="{'Submit'|@translate}" {$TAG_INPUT_ENABLED} />
</p>
</form>
-<!-- END create -->
-<!-- BEGIN update -->
-<a href="{local_listing.update.U_SYNCHRONIZE}" title="{lang:remote_site_local_update}">{lang:site_synchronize}</a>
-<!-- END update -->
-<!-- END local_listing -->
+{/if}
+{if isset($local_listing.U_SYNCHRONIZE)}
+&nbsp;<a href="{$local_listing.U_SYNCHRONIZE}" title="{'remote_site_local_update'|@translate}">{'site_synchronize'|@translate}</a>
+<br/><br/>
+{/if}
+{/if}
-<!-- BEGIN sites -->
+{if not empty($sites)}
<table border="1" cellpadding="0" cellspacing="0">
- <!-- BEGIN site -->
- <tr align="left"><td>
- <a href="{sites.site.NAME}">{sites.site.NAME}</a><br>({sites.site.TYPE}, {sites.site.CATEGORIES} {lang:Categories}, {sites.site.IMAGES} {lang:picture}s)
+ {foreach from=$sites item=site}
+ <tr style="text-align:left"><td>
+ <a href="{$site.NAME}">{$site.NAME}</a><br/>({$site.TYPE}, {$site.CATEGORIES} {'Categories'|@translate}, {$pwg->l10n_dec('%d element','%d elements',$site.IMAGES)})
</td><td>
- [<a href="{sites.site.U_SYNCHRONIZE}" title="{lang:site_synchronize_hint}">{lang:site_synchronize}</a>]
- <!-- BEGIN delete -->
- [<a href="{sites.site.delete.U_DELETE}" onclick="return confirm('{lang:Are you sure?}');"
- title="{lang:site_delete_hint}" {TAG_INPUT_ENABLED}>{lang:site_delete}</a>]
- <!-- END delete -->
- <!-- BEGIN remote -->
- <br>
- [<a href="{sites.site.remote.U_TEST}" title="{lang:remote_site_test_hint}" {TAG_INPUT_ENABLED}>{lang:remote_site_test}</a>]
- [<a href="{sites.site.remote.U_GENERATE}" title="{lang:remote_site_generate_hint}" {TAG_INPUT_ENABLED}>{lang:remote_site_generate}</a>]
- [<a href="{sites.site.remote.U_CLEAN}" title="{lang:remote_site_clean_hint}" {TAG_INPUT_ENABLED}>{lang:remote_site_clean}</a>]
- <!-- END remote -->
- <!-- BEGIN plugin_links -->
+ [<a href="{$site.U_SYNCHRONIZE}" title="{'site_synchronize_hint'|@translate}">{'site_synchronize'|@translate}</a>]
+ {if isset($site.U_DELETE)}
+ [<a href="{$site.U_DELETE}" onclick="return confirm('{'Are you sure?'|@translate|escape:'javascript'}');"
+ title="{'site_delete_hint'|@translate}" {$TAG_INPUT_ENABLED}>{'site_delete'|@translate}</a>]
+ {/if}
+ {if isset($site.remote)}
+ <br/>
+ [<a href="{$site.remote.U_TEST}" title="{'remote_site_test_hint'|@translate}" {$TAG_INPUT_ENABLED}>{'remote_site_test'|@translate}</a>]
+ [<a href="{$site.remote.U_GENERATE}" title="{'remote_site_generate_hint'|@translate}" {$TAG_INPUT_ENABLED}>{'remote_site_generate'|@translate}</a>]
+ [<a href="{$site.remote.U_CLEAN}" title="{'remote_site_clean_hint'|@translate}" {$TAG_INPUT_ENABLED}>{'remote_site_clean'|@translate}</a>]
+ {/if}
+ {if not empty($site.plugin_links)}
<br>
- <!-- BEGIN plugin_link -->
- [<a href="{sites.site.plugin_links.plugin_link.U_HREF}" title='{sites.site.plugin_links.plugin_link.U_HINT}' {TAG_INPUT_ENABLED}>{sites.site.plugin_links.plugin_link.U_CAPTION}</a>]
- <!-- END plugin_link -->
- <!-- END plugin_links -->
+ {foreach from=$site.plugin_links item=plugin_link}
+ [<a href="{$plugin_link.U_HREF}" title='{$plugin_link.U_HINT}' {$TAG_INPUT_ENABLED}>{$plugin_link.U_CAPTION}</a>]
+ {/foreach}
+ {/if}
</td></tr>
- <!-- END site -->
+ {/foreach}
</table>
-<!-- END sites -->
+{/if}
-<form action="{F_ACTION}" method="post">
+<form action="{$F_ACTION}" method="post">
<p>
- <label for="galleries_url" >{lang:site_create}</label>
+ <label for="galleries_url" >{'site_create'|@translate}</label>
<input type="text" name="galleries_url" id="galleries_url" />
</p>
<p>
- <input class="submit" type="submit" name="submit" value="{lang:submit}" {TAG_INPUT_ENABLED} />
+ <input class="submit" type="submit" name="submit" value="{'Submit'|@translate}" {$TAG_INPUT_ENABLED} />
</p>
</form>