{% extends basetemplate %}
-{% load i18n %}
+{% load i18n extra_tags %}
{% block adminjs %}
{{ block.super }}
+
+<style type="text/css">
+#update_check_status {
+ margin-top: 5px;
+ padding: 5px 0;
+ display: none;
+}
+</style>
+
<script type="text/javascript">
$(function() {
$('#check_for_updates').live('click', function() {
- alert("Ok")
+ var update_check_url = $(this).attr('href')
+ var update_check_status = $('#update_check_status')
+ update_check_status.html('{% trans "Checking for updates" %}')
+ update_check_status.show('slow')
+
+ $.get(update_check_url, function(data) {
+ update_check_status.hide('slow', function() {
+ update_check_status.html(data)
+ update_check_status.show('slow');
+ })
+ })
+ return false;
})
});
</script>
{% block admincontent %}
-<a href="javascript:void(0);" id="check_for_updates" class="button">{% trans "Check for Updates" %}</a>
+<a href="{% url updater_check %}" id="check_for_updates" class="button">{% trans "Check for Updates" %}</a>
+<div id="update_check_status"></div>
{% endblock %}
import urllib2, urllib
import binascii
+from xml.dom.minidom import parse, parseString
+
from django import VERSION as DJANGO_VERSION
from django.http import HttpResponse
from django.utils.translation import ugettext as _
except urllib2.HTTPError, error:
content = error.read()
- json = simplejson.dumps({})
- return HttpResponse(content, mimetype='text/html')
\ No newline at end of file
+ # Read the messages from the Update Server
+ messages_xml_url = '%s%s' % (UPDATE_SERVER_URL, '/messages/xml/')
+ messages_request = urllib2.Request(messages_xml_url, headers=headers)
+ messages_response = urllib2.urlopen(messages_request)
+ messages_xml = messages_response.read()
+
+ messages_dom = parseString(messages_xml)
+ messages_count = len(messages_dom.getElementsByTagName('message'))
+
+ return HttpResponse(_('%d update messages have been downloaded') % messages_count, mimetype='text/html')
\ No newline at end of file