Improve display for plugins and themes update page.

git-svn-id: http://piwigo.org/svn/trunk@9493 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
patdenice 2011-03-03 11:54:46 +00:00
parent 20e9a3378b
commit 2fcd11c28e
6 changed files with 98 additions and 118 deletions

View file

@ -133,7 +133,8 @@ if ($plugins->get_server_plugins())
'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$plugin_info['extension_id'],
'EXT_DESC' => trim($plugin_info['extension_description'], " \n\r"),
'REV_DESC' => trim($plugin_info['revision_description'], " \n\r"),
'VERSION' => $plugin_info['revision_name'],
'CURRENT_VERSION' => $fs_plugin['version'],
'NEW_VERSION' => $plugin_info['revision_name'],
'AUTHOR' => $plugin_info['author_name'],
'DOWNLOADS' => $plugin_info['extension_nb_downloads'],
'URL_UPDATE' => $url_auto_update,

View file

@ -1,10 +1,14 @@
{combine_script id='jquery.ui' load='async' require='jquery' path='themes/default/js/jquery.ui.min.js' }
{combine_script id='jquery.cluetip' load='async' require='jquery' path='themes/default/js/plugins/jquery.cluetip.packed.js'}
{footer_script require='jquery.cluetip'}
jQuery().ready(function(){ldelim}
jQuery('.cluetip').cluetip({ldelim}
width: 300,
splitTitle: '|'
{combine_script id='jquery.ui.effects' load='async' require='jquery.ui' path='themes/default/js/ui/minified/jquery.effects.core.min.js' }
{combine_script id='jquery.ui.effects.blind' load='async' require='jquery.ui.effects' path='themes/default/js/ui/minified/jquery.effects.blind.min.js' }
{footer_script require='jquery.ui.effects.blind'}
jQuery(document).ready(function(){ldelim}
jQuery("td[id^='desc_'], p[id^='revdesc_']").click(function() {ldelim}
id = this.id.split('_');
jQuery("#revdesc_"+id[1]).toggle('blind');
jQuery(".button_"+id[1]).toggle();
return false;
});
});
{/footer_script}
@ -18,24 +22,34 @@ jQuery().ready(function(){ldelim}
<fieldset>
<legend>{'Plugins which need upgrade'|@translate}</legend>
{foreach from=$plugins item=plugin name=plugins_loop}
<div class="pluginBox" id="plugin_{$plugin.ID}">
<div class="pluginBox">
<table>
<tr>
<td class="pluginBoxNameCell">
<a href="{$plugin.EXT_URL}" class="externalLink cluetip" title="{$plugin.EXT_NAME}|{$plugin.EXT_DESC|htmlspecialchars|nl2br}">{$plugin.EXT_NAME}</a>
{$plugin.EXT_NAME}
</td>
<td>
<a href="{$plugin.URL_UPDATE}" onclick="return confirm('{'Are you sure to install this upgrade? You must verify if this version does not need uninstallation.'|@translate|@escape:javascript}');">{'Automatic upgrade'|@translate}</a>
| <a href="{$plugin.URL_DOWNLOAD}">{'Download file'|@translate}</a>
<a href="{$plugin.URL_UPDATE}" onclick="return confirm('{'Are you sure to install this upgrade? You must verify if this version does not need uninstallation.'|@translate|@escape:javascript}');">{'Install'|@translate}</a>
| <a href="{$plugin.URL_DOWNLOAD}">{'Download'|@translate}</a>
| <a class="externalLink" href="{$plugin.EXT_URL}">{'Visit plugin site'|@translate}</a>
</td>
</tr>
<tr>
<td>
<a href="{$plugin.EXT_URL}" class="externalLink cluetip" title="{'Version'|@translate} {$plugin.VERSION}|{$plugin.REV_DESC|htmlspecialchars|nl2br}"> {'Version'|@translate} {$plugin.VERSION}</a>
{'Version'|@translate} {$plugin.CURRENT_VERSION}
</td>
<td>
<td class="pluginDesc" id="desc_{$plugin.ID}">
<em>{'Downloads'|@translate}: {$plugin.DOWNLOADS}</em>
{'By %s'|@translate|@sprintf:$plugin.AUTHOR}
<img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/plus.gif" alt="" class="button_{$plugin.ID}">
<img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/minus.gif" alt="" class="button_{$plugin.ID}" style="display:none;">
{'New Version'|@translate} : {$plugin.NEW_VERSION}
| {'By %s'|@translate|@sprintf:$plugin.AUTHOR}
</td>
</tr>
<tr>
<td></td>
<td class="pluginDesc">
<p id="revdesc_{$plugin.ID}" style="display:none;">{$plugin.REV_DESC|htmlspecialchars|nl2br}</p>
</td>
</tr>
</table>

View file

@ -1,77 +1,62 @@
{combine_script id='jquery.cluetip' load='async' require='jquery' path='themes/default/js/plugins/jquery.cluetip.packed.js'}
{footer_script require='jquery.cluetip'}
jQuery().ready(function(){ldelim}
jQuery('.cluetip').cluetip({ldelim}
width: 300,
splitTitle: '|'
{combine_script id='jquery.ui' load='async' require='jquery' path='themes/default/js/jquery.ui.min.js' }
{combine_script id='jquery.ui.effects' load='async' require='jquery.ui' path='themes/default/js/ui/minified/jquery.effects.core.min.js' }
{combine_script id='jquery.ui.effects.blind' load='async' require='jquery.ui.effects' path='themes/default/js/ui/minified/jquery.effects.blind.min.js' }
{footer_script require='jquery.ui.effects.blind'}
jQuery(document).ready(function(){ldelim}
jQuery("td[id^='desc_'], p[id^='revdesc_']").click(function() {ldelim}
id = this.id.split('_');
jQuery("#revdesc_"+id[1]).toggle('blind');
jQuery(".button_"+id[1]).toggle();
return false;
});
});
{/footer_script}
<div class="titrePage">
<h2>{'Check for updates'|@translate}</h2>
<h2>{'Themes'|@translate}</h2>
</div>
{if isset($themes_not_uptodate)}
<br>
<b>{'Themes which need upgrade'|@translate}</b>
<table class="table2 themes">
<thead>
<tr class="throw">
<td>{'Name'|@translate}</td>
<td>{'Current<br>version'|@translate}</td>
<td>{'Available<br>version'|@translate}</td>
<td>{'Actions'|@translate}</td>
</tr>
</thead>
{foreach from=$themes_not_uptodate item=theme name=themes_loop}
<tr class="{if $smarty.foreach.themes_loop.index is odd}row1{else}row2{/if}">
<td><a href="{$theme.EXT_URL}" class="externalLink cluetip" title="{$theme.EXT_NAME}|{$theme.EXT_DESC|htmlspecialchars|nl2br}">{$theme.EXT_NAME}</a></td>
<td style="text-align:center;">{$theme.VERSION}</td>
<td style="text-align:center;"><a href="{$theme.EXT_URL}" class="externalLink cluetip" title="{$theme.EXT_NAME}|{$theme.NEW_VER_DESC|htmlspecialchars|nl2br}">{$theme.NEW_VERSION}</a></td>
<td style="text-align:center;"><a href="{$theme.URL_UPDATE}" onclick="return confirm('{'Are you sure to install this upgrade? You must verify if this version does not need uninstallation.'|@translate|@escape:javascript}');">{'Automatic upgrade'|@translate}</a>
/ <a href="{$theme.URL_DOWNLOAD}">{'Download file'|@translate}</a></td>
</tr>
{if not empty($update_themes)}
<div id="availablePlugins">
<fieldset>
<legend>{'Themes which need upgrade'|@translate}</legend>
{foreach from=$update_themes item=theme name=themes_loop}
<div class="pluginBox">
<table>
<tr>
<td class="pluginBoxNameCell">
{$theme.EXT_NAME}
</td>
<td>
<a href="{$theme.URL_UPDATE}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');">{'Install'|@translate}</a>
| <a href="{$theme.URL_DOWNLOAD}">{'Download'|@translate}</a>
| <a class="externalLink" href="{$theme.EXT_URL}">{'Visit theme site'|@translate}</a>
</td>
</tr>
<tr>
<td>
{'Version'|@translate} {$theme.CURRENT_VERSION}
</td>
<td class="pluginDesc" id="desc_{$theme.ID}">
<em>{'Downloads'|@translate}: {$theme.DOWNLOADS}</em>
<img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/plus.gif" alt="" class="button_{$theme.ID}">
<img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/minus.gif" alt="" class="button_{$theme.ID}" style="display:none;">
{'New Version'|@translate} : {$theme.NEW_VERSION}
| {'By %s'|@translate|@sprintf:$theme.AUTHOR}
</td>
</tr>
<tr>
<td></td>
<td class="pluginDesc">
<p id="revdesc_{$theme.ID}" style="display:none;">{$theme.REV_DESC|htmlspecialchars|nl2br}</p>
</td>
</tr>
</table>
</div>
{/foreach}
</table>
{/if}
{if isset($themes_uptodate)}
<br>
<b>{'Themes up to date'|@translate}</b>
<table class="table2 plugins">
<thead>
<tr class="throw">
<td>{'Name'|@translate}</td>
<td>{'Version'|@translate}</td>
</tr>
</thead>
{foreach from=$themes_uptodate item=theme name=themes_loop}
<tr class="{if $smarty.foreach.themes_loop.index is odd}row1{else}row2{/if}">
<td><a href="{$theme.URL}" class="externalLink cluetip" title="{$theme.NAME}|{$theme.EXT_DESC|htmlspecialchars|nl2br}">{$theme.NAME}</a></td>
<td style="text-align:center;"><a href="{$theme.URL}" class="externalLink cluetip" title="{$theme.NAME}|{$theme.VER_DESC|htmlspecialchars|nl2br}">{$theme.VERSION}</a></td>
</tr>
{/foreach}
</table>
{/if}
{if isset($themes_cant_check)}
<br>
<b>{'Theme versions can\'t be checked'|@translate}</b>
<table class="table2 plugins">
<thead>
<tr class="throw">
<td>{'Name'|@translate}</td>
<td>{'Version'|@translate}</td>
</tr>
</thead>
{foreach from=$themes_cant_check item=theme name=themes_loop}
<tr class="{if $smarty.foreach.themes_loop.index is odd}row1{else}row2{/if}">
<td>{$theme.NAME}</td>
<td style="text-align:center;">{$theme.VERSION}</td>
</tr>
{/foreach}
</table>
</fieldset>
</div>
{elseif not isset($SERVER_ERROR)}
<p>{'All themes are up to date.'|@translate}</p>
{/if}

View file

@ -97,59 +97,35 @@ if ($themes->get_server_themes())
{
$theme_info = $themes->server_themes[$fs_theme['extension']];
list($date, ) = explode(' ', $theme_info['revision_date']);
$ext_desc = '<i>'.l10n('Downloads').':</i> '.$theme_info['extension_nb_downloads']."\r\n"
."\r\n"
.$theme_info['extension_description'];
$rev_desc = '<i>'.l10n('Version').':</i> '.$theme_info['revision_name']."\r\n"
.'<i>'.l10n('Released on').':</i> '.$date."\r\n"
.'<i>'.l10n('Downloads').':</i> '.$theme_info['revision_nb_downloads']."\r\n"
."\r\n"
.$theme_info['revision_description'];
if ($themes->theme_version_compare($fs_theme['version'], $theme_info['revision_name']))
if (!$themes->theme_version_compare($fs_theme['version'], $theme_info['revision_name']))
{
// Plugin is up to date
$template->append('themes_uptodate', array(
'URL' => PEM_URL.'/extension_view.php?eid='.$theme_info['extension_id'],
'NAME' => $fs_theme['name'],
'EXT_DESC' => $ext_desc,
'VERSION' => $fs_theme['version'],
'VER_DESC' => $rev_desc));
}
else
{
// Plugin need upgrade
$url_auto_update = $base_url
. '&amp;revision=' . $theme_info['revision_id']
. '&amp;theme=' . $theme_id
. '&amp;pwg_token='.get_pwg_token()
;
$template->append('themes_not_uptodate', array(
$template->append('update_themes', array(
'ID' => $theme_info['extension_id'],
'EXT_NAME' => $fs_theme['name'],
'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$theme_info['extension_id'],
'EXT_DESC' => $ext_desc,
'VERSION' => $fs_theme['version'],
'EXT_DESC' => trim($theme_info['extension_description'], " \n\r"),
'REV_DESC' => trim($theme_info['revision_description'], " \n\r"),
'CURRENT_VERSION' => $fs_theme['version'],
'NEW_VERSION' => $theme_info['revision_name'],
'NEW_VER_DESC' => $rev_desc,
'AUTHOR' => $theme_info['author_name'],
'DOWNLOADS' => $theme_info['extension_nb_downloads'],
'URL_UPDATE' => $url_auto_update,
'URL_DOWNLOAD' => $theme_info['download_url'] . '&amp;origin=piwigo_download'));
'URL_DOWNLOAD' => $theme_info['download_url'] . '&amp;origin=piwigo_download'
)
);
}
}
else
{
// Can't check theme
$template->append('themes_cant_check', array(
'NAME' => $fs_theme['name'],
'VERSION' => $fs_theme['version']));
}
}
}
else
{
$template->assign('SERVER_ERROR', true);
array_push($page['errors'], l10n('Can\'t connect to server.'));
}

View file

@ -776,4 +776,6 @@ $lang['[Simulation]'] = "[Simulation]";
$lang['Themes which need upgrade'] = 'Themes which need upgrade';
$lang['All themes are up to date.'] = 'All themes are up to date.';
$lang['All plugins are up to date.'] = 'All plugins are up to date.';
$lang['Visit theme site'] = 'Visit theme site';
$lang['New Version'] = 'New Version';
?>

View file

@ -789,4 +789,6 @@ $lang['Remove from caddie'] = 'Retirer du panier';
$lang['Themes which need upgrade'] = 'Thèmes à mettre à jour';
$lang['All themes are up to date.'] = 'Tous les thèmes sont à jour.';
$lang['All plugins are up to date.'] = 'Tous les plugins sont à jour.';
$lang['Visit theme site'] = 'Visitez le site du thème';
$lang['New Version'] = 'Nouvelle version';
?>