calendar improvement

remotes/origin/1203
Ivan 10 years ago
parent 5bccc152db
commit 8c17d9417e
  1. 4
      core/utils.py
  2. 21
      core/views.py
  3. 22
      templates/client/accounts/calendar.html

@ -83,13 +83,13 @@ def queryset_to_workbook(queryset, columns, report_date = None):
'pattern: pattern solid, fore_color gray_ega;',
)
odd_style = xlwt.Style.easyxf(
'font: name Calibri, height 300, bold False;'
'font: name Calibri, height 240, bold False;'
'borders: left thin, right thin, top thin, bottom thin;'
'alignment: horizontal center, vertical center, wrap True;'
'pattern: pattern solid, fore_color white;',
)
even_style = xlwt.Style.easyxf(
'font: name Calibri, height 300, bold False;'
'font: name Calibri, height 240, bold False;'
'borders: left thin, right thin, top thin, bottom thin;'
'alignment: horizontal center, vertical center, wrap True;'
'pattern: pattern solid, fore_color silver_ega;',

@ -266,13 +266,18 @@ def download_workbook(request):
lang = get_language()
data = request.GET
if data:
qs = []
for i,obj in enumerate(data):
if data.get('data[%i][name]' % i) == 'expo':
qs.append(Exposition.objects.language(lang).get(id=data['data[%i][value]'%i]))
elif data.get('data[%i][name]' % i) == 'conf':
qs.append(Conference.objects.language(lang).get(id=data['data[%i][value]'%i]))
if data.get('filter') == u'future':
qs = request.user.calendar.get_events()
qs = [event for event in qs if event.data_begin > datetime.date.today()]
else:
qs = []
for i,obj in enumerate(data):
if data.get('data[%i][name]' % i) == 'expo':
qs.append(Exposition.objects.language(lang).get(id=data['data[%i][value]'%i]))
elif data.get('data[%i][name]' % i) == 'conf':
qs.append(Conference.objects.language(lang).get(id=data['data[%i][value]'%i]))
if not qs:
return HttpResponseRedirect("/profile/calendar/?message=empty")
earliest_event = qs[0].data_begin
for i, obj in enumerate(qs, start=1):
if obj.data_begin < earliest_event:
@ -305,4 +310,4 @@ def download_workbook(request):
workbook.save(response)
return response
else:
return HttpResponseRedirect(request.META.get('HTTP_REFERER'), "/profile/calendar/")
return HttpResponseRedirect("/profile/calendar/")

@ -20,14 +20,18 @@
{% block content_list %}
<div class="m-article p-calendar">
{% with days=days events=events current_day=current_day %}
{% include 'includes/accounts/calendar_table.html' %}
{% include 'client/includes/accounts/calendar_table.html' %}
{% endwith %}
</div>
<div class="m-article cal-lists">
{% if events|length > 0 %}
<div class="cl-sect">
<div class="cls-title">{{ days.15|date:"F"}}’{{ days.15|date:"y"}}</div>
<div class="cls-title">{{ days.15|date:"F"}}’{{ days.15|date:"y"}}
<div style="float:right;margin-right: 5px;" class="check-wrap">
<label class="check"><input type="checkbox" id="selectall"/></label>
</div>
</div>
{% include 'client/includes/accounts/calendar_list.html' with events=events %}
</div>
@ -35,8 +39,8 @@
<div class="cla-title">{% trans 'Все / выделенные:' %}</div>
<div class="cla-btns">
<a class="button" id="btn_delete" href="#">{% trans 'удалить из расписания' %}</a>
<a id ='export' class="button icon-save" href="#">{% trans 'сохранить в xls' %}</a>
<a id ='export' class="button icon-save" href="#">{% trans 'выбраные в xls' %}</a>
<a id ='future' class="button icon-save" href="#">{% trans 'все предстоящие в xls' %}</a>
<!--<a class="button icon-calendar-o" href="#">{% trans 'ЭКСПОРТИРОВАТЬ В' %} <span class="lc">iCal</span></a>
@ -54,6 +58,16 @@
</div>
<script>
$(function(){
if(window.location.search === "?message=empty"){
alert("{% trans 'У вас нету событий в будущем!' %}");
window.location.search = ""
}
$('#selectall').click(function(event) { //on click
$(".qwer").trigger("click");
});
$("#future").click(function(event) {
window.location.href = "/profile/calendar/export/?" + "filter=future";
});
$("#export").click(function(event){
event.preventDefault();
var list = $('.qwer');

Loading…
Cancel
Save