aboutsummaryrefslogtreecommitdiffstats
path: root/admin/themes/default/template
diff options
context:
space:
mode:
authorpatdenice <patdenice@piwigo.org>2011-04-20 14:52:52 +0000
committerpatdenice <patdenice@piwigo.org>2011-04-20 14:52:52 +0000
commit491e8adc7467de9f9aa6dbbebfcb8b82c676b46a (patch)
treeaad72cf4b73fa2bd6ffb6e91c174d18547410741 /admin/themes/default/template
parentfede13ce419b40ca22cf58b76f74d44d6d564dac (diff)
feature:2271
Merge autoupdate plugin into piwigo core. git-svn-id: http://piwigo.org/svn/trunk@10511 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/themes/default/template/admin.tpl1
-rw-r--r--admin/themes/default/template/updates_ext.tpl272
-rw-r--r--admin/themes/default/template/updates_pwg.tpl99
3 files changed, 372 insertions, 0 deletions
diff --git a/admin/themes/default/template/admin.tpl b/admin/themes/default/template/admin.tpl
index 2daad8118..56a92a75e 100644
--- a/admin/themes/default/template/admin.tpl
+++ b/admin/themes/default/template/admin.tpl
@@ -75,6 +75,7 @@ jQuery(document).ready(function(){ldelim}
{/if}
<li><a href="{$U_MAINTENANCE}">{'Maintenance'|@translate}</a></li>
<li><a href="{$U_PENDING_COMMENTS}">{'Pending Comments'|@translate}</a></li>
+ <li><a href="{$U_UPDATES}">{'Updates'|@translate}</a></li>
</ul>
</dd>
</dl>
diff --git a/admin/themes/default/template/updates_ext.tpl b/admin/themes/default/template/updates_ext.tpl
new file mode 100644
index 000000000..d0cd7a2a7
--- /dev/null
+++ b/admin/themes/default/template/updates_ext.tpl
@@ -0,0 +1,272 @@
+{combine_script id='jquery.ajaxmanager' load='footer' require='jquery' path='themes/default/js/plugins/jquery.ajaxmanager.js'}
+{combine_script id='jquery.jgrowl' load='footer' require='jquery' path='themes/default/js/plugins/jquery.jgrowl_minimized.js'}
+{combine_css path="admin/themes/default/uploadify.jGrowl.css"}
+
+{footer_script require='jquery.effects.blind,jquery.ajaxmanager,jquery.jgrowl'}
+var pwg_token = '{$PWG_TOKEN}';
+var extList = new Array();
+var confirmMsg = '{'Are you sure?'|@translate|@escape:'javascript'}';
+var errorHead = '{'ERROR'|@translate|@escape:'javascript'}';
+var successHead = '{'Update Complete'|@translate|@escape:'javascript'}';
+var errorMsg = '{'an error happened'|@translate|@escape:'javascript'}';
+var restoreMsg = '{'Reset ignored updates'|@translate|@escape:'javascript'}';
+
+{literal}
+var todo = 0;
+var queuedManager = $.manageAjax.create('queued', {
+ queue: true,
+ maxRequests: 1,
+ beforeSend: function() { autoupdate_bar_toggle(1); },
+ complete: function() { autoupdate_bar_toggle(-1); }
+});
+
+function updateAll() {
+ if (confirm(confirmMsg)) {
+ jQuery('.updateExtension').each( function() {
+ if (jQuery(this).parents('div').css('display') == 'block')
+ jQuery(this).click();
+ });
+ }
+};
+
+function resetIgnored() {
+ jQuery.ajax({
+ type: 'GET',
+ url: 'ws.php',
+ dataType: 'json',
+ data: { method: 'pwg.extensions.ignoreUpdate', reset: true, pwg_token: pwg_token, format: 'json' },
+ success: function(data) {
+ if (data['stat'] == 'ok') {
+ jQuery(".pluginBox, fieldset").show();
+ jQuery("#update_all").show();
+ jQuery("#up_to_date").hide();
+ jQuery("#reset_ignore").hide();
+ jQuery("#ignored").hide();
+ checkFieldsets();
+ }
+ }
+ });
+};
+
+function checkFieldsets() {
+ var types = new Array('plugins', 'themes', 'languages');
+ var total = 0;
+ var ignored = 0;
+ for (i=0;i<3;i++) {
+ nbExtensions = 0;
+ jQuery("div[id^='"+types[i]+"_']").each(function(index) {
+ if (jQuery(this).css('display') == 'block')
+ nbExtensions++;
+ else
+ ignored++;
+ });
+ total = total + nbExtensions;
+ if (nbExtensions == 0)
+ jQuery("#"+types[i]).hide();
+ }
+
+ if (total == 0) {
+ jQuery("#update_all").hide();
+ jQuery("#up_to_date").show();
+ }
+ if (ignored > 0) {
+ jQuery("#reset_ignore").val(restoreMsg + ' (' + ignored + ')');
+ }
+};
+
+function updateExtension(type, id, revision) {
+ queuedManager.add({
+ type: 'GET',
+ dataType: 'json',
+ url: 'ws.php',
+ data: { method: 'pwg.extensions.update', type: type, id: id, revision: revision, pwg_token: pwg_token, format: 'json' },
+ success: function(data) {
+ if (data['stat'] == 'ok') {
+ jQuery.jGrowl( data['result'], { theme: 'success', header: successHead, life: 4000, sticky: false });
+ jQuery("#"+type+"_"+id).remove();
+ checkFieldsets();
+ } else {
+ jQuery.jGrowl( data['result'], { theme: 'error', header: errorHead, sticky: true });
+ }
+ },
+ error: function(data) {
+ jQuery.jGrowl( errorMsg, { theme: 'error', header: errorHead, sticky: true });
+ }
+ });
+};
+
+function ignoreExtension(type, id) {
+ jQuery.ajax({
+ type: 'GET',
+ url: 'ws.php',
+ dataType: 'json',
+ data: { method: 'pwg.extensions.ignoreUpdate', type: type, id: id, pwg_token: pwg_token, format: 'json' },
+ success: function(data) {
+ if (data['stat'] == 'ok') {
+ jQuery("#"+type+"_"+id).hide();
+ jQuery("#reset_ignore").show();
+ checkFieldsets();
+ }
+ }
+ });
+};
+
+function autoupdate_bar_toggle(i) {
+ todo = todo + i;
+ if ((i == 1 && todo == 1) || (i == -1 && todo == 0))
+ jQuery('.autoupdate_bar').toggle();
+}
+
+jQuery(document).ready(function() {
+ jQuery("td[id^='desc_'], p[id^='revdesc_']").click(function() {
+ id = this.id.split('_');
+ jQuery("#revdesc_"+id[1]).toggle('blind');
+ jQuery(".button_"+id[1]).toggle();
+ return false;
+ });
+});
+
+checkFieldsets();
+{/literal}
+{/footer_script}
+
+<div class="titrePage">
+ <h2>{'Updates'|@translate}</h2>
+</div>
+
+<div class="autoupdate_bar">
+<br>
+<input type="submit" id="update_all" value="{'Update All'|@translate}" onClick="updateAll(); return false;">
+<input type="submit" id="reset_ignore" value="{'Reset ignored updates'|@translate}" onClick="resetIgnored(); return false;" {if !$SHOW_RESET}style="display:none;"{/if}>
+</div>
+<div class="autoupdate_bar" style="display:none;">
+{'Update in progress... Please wait.'|@translate}<br><img src="admin/themes/default/images/ajax-loader-bar.gif">
+</div>
+
+<p id="up_to_date" style="display:none; text-align:left; margin-left:20px;">{'All extensions are up to date.'|@translate}</p>
+
+{if not empty($update_plugins)}
+<div>
+<fieldset id="plugins">
+<legend>{'Plugins'|@translate}</legend>
+{foreach from=$update_plugins item=plugin name=plugins_loop}
+<div class="pluginBox" id="plugins_{$plugin.EXT_ID}" {if $plugin.IGNORED}style="display:none;"{/if}>
+ <table>
+ <tr>
+ <td class="pluginBoxNameCell">
+ {$plugin.EXT_NAME}
+ </td>
+ <td>
+ <a href="#" onClick="updateExtension('plugins', '{$plugin.EXT_ID}', {$plugin.REVISION_ID});" class="updateExtension">{'Install'|@translate}</a>
+ | <a href="{$plugin.URL_DOWNLOAD}">{'Download'|@translate}</a>
+ | <a href="#" onClick="ignoreExtension('plugins', '{$plugin.EXT_ID}'); return false;">{'Ignore this update'|@translate}</a>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ {'Version'|@translate} {$plugin.CURRENT_VERSION}
+ </td>
+ <td class="pluginDesc" id="desc_{$plugin.ID}">
+ <em>{'Downloads'|@translate}: {$plugin.DOWNLOADS}</em>
+ <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>
+</div>
+{/foreach}
+</fieldset>
+</div>
+{/if}
+
+{if not empty($update_themes)}
+<div>
+<fieldset id="themes">
+<legend>{'Themes'|@translate}</legend>
+{foreach from=$update_themes item=theme name=themes_loop}
+<div class="pluginBox" id="themes_{$theme.EXT_ID}" {if $theme.IGNORED}style="display:none;"{/if}>
+ <table>
+ <tr>
+ <td class="pluginBoxNameCell">
+ {$theme.EXT_NAME}
+ </td>
+ <td>
+ <a href="#" onClick="updateExtension('themes', '{$theme.EXT_ID}', {$theme.REVISION_ID});" class="updateExtension">{'Install'|@translate}</a>
+ | <a href="{$theme.URL_DOWNLOAD}">{'Download'|@translate}</a>
+ | <a href="#" onClick="ignoreExtension('themes', '{$theme.EXT_ID}'); return false;">{'autoupdate_ignore'|@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}
+</fieldset>
+</div>
+{/if}
+
+{if not empty($update_languages)}
+<div>
+<fieldset id="languages">
+<legend>{'Languages'|@translate}</legend>
+{foreach from=$update_languages item=language name=languages_loop}
+<div class="pluginBox" id="languages_{$language.EXT_ID}" {if $language.IGNORED}style="display:none;"{/if}>
+ <table>
+ <tr>
+ <td class="pluginBoxNameCell">
+ {$language.EXT_NAME}
+ </td>
+ <td>
+ <a href="#" onClick="updateExtension('languages', '{$language.EXT_ID}', {$language.REVISION_ID});" class="updateExtension">{'Install'|@translate}</a>
+ | <a href="{$language.URL_DOWNLOAD}">{'Download'|@translate}</a>
+ | <a href="#" onClick="ignoreExtension('languages', '{$language.EXT_ID}'); return false;">{'autoupdate_ignore'|@translate}</a>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ {'Version'|@translate} {$language.CURRENT_VERSION}
+ </td>
+ <td class="pluginDesc" id="desc_{$language.ID}">
+ <em>{'Downloads'|@translate}: {$language.DOWNLOADS}</em>
+ <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/plus.gif" alt="" class="button_{$language.ID}">
+ <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/minus.gif" alt="" class="button_{$language.ID}" style="display:none;">
+ {'New Version'|@translate} : {$language.NEW_VERSION}
+ | {'By %s'|@translate|@sprintf:$language.AUTHOR}
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="pluginDesc">
+ <p id="revdesc_{$language.ID}" style="display:none;">{$language.REV_DESC|htmlspecialchars|nl2br}</p>
+ </td>
+ </tr>
+ </table>
+</div>
+{/foreach}
+</fieldset>
+</div>
+{/if}
diff --git a/admin/themes/default/template/updates_pwg.tpl b/admin/themes/default/template/updates_pwg.tpl
new file mode 100644
index 000000000..c85e1fb6b
--- /dev/null
+++ b/admin/themes/default/template/updates_pwg.tpl
@@ -0,0 +1,99 @@
+{footer_script}
+jQuery(document).ready(function() {ldelim}
+ jQuery('input[name="submit"]').click(function() {ldelim}
+ if(!confirm('{'autoupdate_alert'|@translate}'))
+ return false;
+ jQuery(this).hide();
+ jQuery('.autoupdate_bar').show();
+ });
+ jQuery('[name="understand"]').click(function() {ldelim}
+ jQuery('[name="submit"]').attr('disabled', !this.checked);
+ });
+});
+{/footer_script}
+
+{html_head}
+{literal}
+<style type="text/css">
+form { width: 750px; }
+fieldset { padding-bottom: 30px; }
+p, form p { text-align: left; margin-left:20px; }
+li { margin: 5px; }
+</style>
+{/literal}
+{/html_head}
+
+<div class="titrePage">
+<h2>{'Updates'|@translate}</h2>
+</div>
+
+{if $STEP == 0}
+ {if $CHECK_VERSION}
+ <p>{'You are running the latest version of Piwigo.'|@translate}</p>
+ {elseif $DEV_VERSION}
+ <p>{'You are running on development sources, no check possible.'|@translate}</p>
+ {else}
+ <p>{'Check for update failed for unknown reasons.'|@translate}</p>
+ {/if}
+{/if}
+
+{if $STEP == 1}
+<h4>{'Two updates are available'|@translate}:</h4>
+<p>
+<ul>
+ <li><a href="admin.php?page=updates&amp;step=2&amp;to={$MINOR_VERSION}"><strong>{'Update to Piwigo %s'|@translate|@sprintf:$MINOR_VERSION}</strong></a>: {'This is a minor update, with only bug corrections.'|@translate}</li>
+ <li><a href="admin.php?page=updates&amp;step=3&amp;to={$MAJOR_VERSION}"><strong>{'Update to Piwigo %s'|@translate|@sprintf:$MAJOR_VERSION}</strong></a>: {'This is a major update, with <a href="%s">new exciting features</a>.'|@translate|@sprintf:$RELEASE_URL} {'Some themes and plugins may be not available yet.'|@translate}</li>
+</ul>
+</p>
+<p>{'You can update to Piwigo %s directly, without upgrading to Piwigo %s (recommended).'|@translate|@sprintf:$MAJOR_VERSION:$MINOR_VERSION}</p>
+{/if}
+
+{if $STEP == 2}
+<p>
+ {'A new version of Piwigo is available.'|@translate}<br>
+ {'This is a minor update, with only bug corrections.'|@translate}
+</p>
+<form action="" method="post">
+<p><input type="submit" name="submit" value="{'Update to Piwigo %s'|@translate|@sprintf:$UPGRADE_TO}"></p>
+<p class="autoupdate_bar" style="display:none;">&nbsp; {'Update in progress...'|@translate}<br><img src="admin/themes/default/images/ajax-loader-bar.gif"></p>
+<p><input type="hidden" name="upgrade_to" value="{$UPGRADE_TO}"></p>
+</form>
+{/if}
+
+{if $STEP == 3}
+<p>
+ {'A new version of Piwigo is available.'|@translate}<br>
+ {'This is a major update, with <a href="%s">new exciting features</a>.'|@translate|@sprintf:$RELEASE_URL} {'Some themes and plugins may be not available yet.'|@translate}
+</p>
+<form action="" method="post">
+
+{counter assign=i}
+<fieldset>
+ <legend>{'Dump Database'|@translate}</legend>
+ <p><input type="checkbox" name="includeHistory"> &nbsp; {'Include history data (Warning: server memory limit may be exceeded)'|@translate}</p>
+ <p><input type="submit" name="dumpDatabase" value="{'Dump Database'|@translate}"></p>
+</fieldset>
+
+{counter assign=i}
+<fieldset>
+ <legend>{'Update to Piwigo %s'|@translate|@sprintf:$UPGRADE_TO}</legend>
+ {if !empty($missing.plugins)}
+ <p><i>{'Following plugins may not be compatible with the new version of Piwigo:'|@translate}</i></p>
+ <p><ul>{foreach from=$missing.plugins item=plugin}<li><a href="{$plugin.uri}" class="externalLink">{$plugin.name}</a></li>{/foreach}</ul><br></p>
+ {/if}
+ {if !empty($missing.themes)}
+ <p><i>{'Following themes may not be compatible with the new version of Piwigo:'|@translate}</i></p>
+ <p><ul>{foreach from=$missing.themes item=theme}<li><a href="{$theme.uri}" class="externalLink">{$theme.name}</a></li>{/foreach}</ul><br></p>
+ {/if}
+ <p>
+ {if !empty($missing.plugins) or !empty($missing.themes)}
+ <p><label><input type="checkbox" name="understand"> &nbsp;{'I decide to update anyway'|@translate}</label></p>
+ {/if}
+ <p><input type="submit" name="submit" value="{'Update to Piwigo %s'|@translate|@sprintf:$UPGRADE_TO}" {if !empty($missing.plugins) or !empty($missing.themes)}disabled="disabled"{/if}>
+ </p>
+ <p class="autoupdate_bar" style="display:none;">&nbsp; {'Update in progress...'|@translate}<br><img src="admin/themes/default/images/ajax-loader-bar.gif"></p>
+</fieldset>
+
+<p><input type="hidden" name="upgrade_to" value="{$UPGRADE_TO}"></p>
+</form>
+{/if} \ No newline at end of file