2009-10-04 22:00:08 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vi:si:et:sw=4:sts=4:ts=4
|
|
|
|
from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404
|
|
|
|
from django.template import RequestContext
|
2009-10-04 23:48:18 +00:00
|
|
|
from django.conf import settings
|
2009-10-04 22:00:08 +00:00
|
|
|
|
2010-11-23 09:53:12 +00:00
|
|
|
from ox.django.shortcuts import json_response, render_to_json_response, get_object_or_404_json
|
2010-02-10 13:10:14 +00:00
|
|
|
|
|
|
|
import models
|
2009-10-04 22:00:08 +00:00
|
|
|
|
2010-11-14 21:49:16 +00:00
|
|
|
from item.models import siteJson
|
2010-09-19 19:21:12 +00:00
|
|
|
|
2010-12-22 07:45:37 +00:00
|
|
|
from api.actions import actions
|
|
|
|
|
2010-08-24 17:16:33 +00:00
|
|
|
def intro(request):
|
|
|
|
context = RequestContext(request, {'settings':settings})
|
|
|
|
return render_to_response('intro.html', context)
|
|
|
|
|
2009-10-04 22:00:08 +00:00
|
|
|
def index(request):
|
2010-02-08 10:26:25 +00:00
|
|
|
context = RequestContext(request, {'settings':settings})
|
2010-09-19 19:21:12 +00:00
|
|
|
if request.GET.get('_escaped_fragment_', None):
|
|
|
|
return html_snapshot(request)
|
2009-10-04 22:00:08 +00:00
|
|
|
return render_to_response('index.html', context)
|
|
|
|
|
2010-09-08 11:56:58 +00:00
|
|
|
def timeline(request):
|
|
|
|
context = RequestContext(request, {'settings':settings})
|
|
|
|
return render_to_response('timeline.html', context)
|
|
|
|
|
2010-12-22 07:45:37 +00:00
|
|
|
def getPage(request):
|
2010-02-10 13:10:14 +00:00
|
|
|
data = json.loads(request.POST['data'])
|
|
|
|
name = data['page']
|
|
|
|
page = get_object_or_404_json(models.Archive, name=name)
|
|
|
|
response = json_response({'name': page.name, 'body': page.body})
|
|
|
|
return render_to_json_response(response)
|
2010-12-22 07:45:37 +00:00
|
|
|
actions.register(getPage)
|
2010-02-10 13:10:14 +00:00
|
|
|
|
2010-11-06 16:18:12 +00:00
|
|
|
def site_json(request):
|
2010-12-22 07:45:37 +00:00
|
|
|
'''
|
2010-11-14 21:49:16 +00:00
|
|
|
return render_to_json_response(siteJson())
|
|
|
|
'''
|
2010-09-07 13:08:23 +00:00
|
|
|
siteSettings = {}
|
|
|
|
for s in models.SiteSettings.objects.all():
|
|
|
|
siteSettings[s.key] = s.value
|
|
|
|
context = RequestContext(request, {'settings':settings, 'siteSettings': siteSettings})
|
2010-11-06 16:18:12 +00:00
|
|
|
return render_to_response('site.json', context, mimetype="application/javascript")
|
2010-12-22 07:45:37 +00:00
|
|
|
|