From 0bef11834fdacf56c2dd033e6c6a0747b365ff9c Mon Sep 17 00:00:00 2001 From: sanj Date: Mon, 6 Dec 2010 23:33:00 +0100 Subject: [PATCH] added best practices --- itf/api/__init__.py | 0 itf/api/models.py | 3 + itf/api/tests.py | 23 + itf/api/views.py | 155 +++++++ itf/app/__init__.py | 0 itf/app/models.py | 3 + itf/app/tests.py | 23 + itf/app/views.py | 23 + itf/bestpractices/admin.py | 4 + itf/erang_organised/views.py | 2 +- itf/settings.py | 2 + itf/static/js/itf.js | 565 ++++++++++++++++++++++++ itf/static/js/jquery/jquery.tmpl.min.js | 1 + itf/templates/index.html | 24 +- itf/urls.py | 20 +- requirements.txt | 2 +- 16 files changed, 840 insertions(+), 10 deletions(-) create mode 100644 itf/api/__init__.py create mode 100644 itf/api/models.py create mode 100644 itf/api/tests.py create mode 100644 itf/api/views.py create mode 100644 itf/app/__init__.py create mode 100644 itf/app/models.py create mode 100644 itf/app/tests.py create mode 100644 itf/app/views.py create mode 100644 itf/bestpractices/admin.py create mode 100644 itf/static/js/itf.js create mode 100644 itf/static/js/jquery/jquery.tmpl.min.js diff --git a/itf/api/__init__.py b/itf/api/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/itf/api/models.py b/itf/api/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/itf/api/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/itf/api/tests.py b/itf/api/tests.py new file mode 100644 index 0000000..2247054 --- /dev/null +++ b/itf/api/tests.py @@ -0,0 +1,23 @@ +""" +This file demonstrates two different styles of tests (one doctest and one +unittest). These will both pass when you run "manage.py test". + +Replace these with more appropriate tests for your application. +""" + +from django.test import TestCase + +class SimpleTest(TestCase): + def test_basic_addition(self): + """ + Tests that 1 + 1 always equals 2. + """ + self.failUnlessEqual(1 + 1, 2) + +__test__ = {"doctest": """ +Another way to test that 1 + 1 is equal to 2. + +>>> 1 + 1 == 2 +True +"""} + diff --git a/itf/api/views.py b/itf/api/views.py new file mode 100644 index 0000000..12ae230 --- /dev/null +++ b/itf/api/views.py @@ -0,0 +1,155 @@ +# -*- coding: utf-8 -*- +# vi:si:et:sw=4:sts=4:ts=4 +from __future__ import division +import os.path +import re +from datetime import datetime +from urllib2 import unquote +import mimetypes + +from django import forms +from django.core.paginator import Paginator +from django.contrib.auth.decorators import login_required +from django.contrib.auth.models import User +from django.db.models import Q, Avg, Count, Sum +from django.http import HttpResponse, Http404 +from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404, redirect +from django.template import RequestContext +from django.conf import settings + +from ox.utils import json +from ox.django.decorators import login_required_json +from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response +from ox.django.http import HttpFileResponse +import ox + + +def api(request): + if request.META['REQUEST_METHOD'] == "OPTIONS": + response = HttpResponse('') + response = render_to_json_response({'status': {'code': 200, 'text': 'use POST'}}) + response['Access-Control-Allow-Origin'] = '*' + return response + if not 'action' in request.POST: + return apidoc(request) + function = request.POST['action'] + #FIXME: possible to do this in f + #data = json.loads(request.POST['data']) + + f = globals().get('api_'+function, None) + if f: + response = f(request) + else: + response = render_to_json_response(json_response(status=400, + text='Unknown function %s' % function)) + response['Access-Control-Allow-Origin'] = '*' + return response + +def api_api(request): + ''' + returns list of all known api action + return {'status': {'code': int, 'text': string}, + 'data': {actions: ['api', 'hello', ...]}} + ''' + actions = globals().keys() + actions = map(lambda a: a[4:], filter(lambda a: a.startswith('api_'), actions)) + actions.sort() + return render_to_json_response(json_response({'actions': actions})) + +def api_apidoc(request): + ''' + returns array of actions with documentation + ''' + actions = globals().keys() + actions = map(lambda a: a[4:], filter(lambda a: a.startswith('api_'), actions)) + actions.sort() + docs = {} + for f in actions: + docs[f] = get_api_doc(f) + return render_to_json_response(json_response({'actions': docs})) + +def api_hello(request): + ''' + return {'status': {'code': int, 'text': string}, + 'data': {user: object}} + ''' + #data = json.loads(request.POST['data']) + response = json_response({}) + if request.user.is_authenticated(): + response['data']['user'] = get_user_json(request.user) + else: + response['data']['user'] = {'name': 'Guest', 'group': 'guest', 'preferences': {}} + return render_to_json_response(response) + +def api_error(request): + ''' + trows 503 error + ''' + success = error_is_success + return render_to_json_response({}) + +def get_api_doc(f): + f = 'api_' + f + + import sys + def trim(docstring): + if not docstring: + return '' + # Convert tabs to spaces (following the normal Python rules) + # and split into a list of lines: + lines = docstring.expandtabs().splitlines() + # Determine minimum indentation (first line doesn't count): + indent = sys.maxint + for line in lines[1:]: + stripped = line.lstrip() + if stripped: + indent = min(indent, len(line) - len(stripped)) + # Remove indentation (first line is special): + trimmed = [lines[0].strip()] + if indent < sys.maxint: + for line in lines[1:]: + trimmed.append(line[indent:].rstrip()) + # Strip off trailing and leading blank lines: + while trimmed and not trimmed[-1]: + trimmed.pop() + while trimmed and not trimmed[0]: + trimmed.pop(0) + # Return a single string: + return '\n'.join(trimmed) + + return trim(globals()[f].__doc__) + +def apidoc(request): + ''' + this is used for online documentation at http://127.0.0.1:8000/api/ + ''' + + functions = filter(lambda x: x.startswith('api_'), globals().keys()) + api = [] + for f in sorted(functions): + api.append({ + 'name': f[4:], + 'doc': get_api_doc(f[4:]).replace('\n', '
\n') + }) + context = RequestContext(request, {'api': api, + 'sitename': settings.SITENAME,}) + return render_to_response('api.html', context) + +def jsdoc(request): + ''' + Used to document OxUI JS Widgets + ''' + context = RequestContext(request, {}) + return render_to_response("jsdoc.html", context) + + +''' + ajax html snapshots + http://code.google.com/web/ajaxcrawling/docs/html-snapshot.html +''' +def html_snapshot(request): + fragment = unquote(request.GET['_escaped_fragment_']) + url = request.build_absolute_uri('/ra') + url = 'http://'+settings.URL + response = HttpResponse('sorry, server side rendering for %s!#%s not yet implemented'%(url, fragment)) + return response diff --git a/itf/app/__init__.py b/itf/app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/itf/app/models.py b/itf/app/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/itf/app/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/itf/app/tests.py b/itf/app/tests.py new file mode 100644 index 0000000..2247054 --- /dev/null +++ b/itf/app/tests.py @@ -0,0 +1,23 @@ +""" +This file demonstrates two different styles of tests (one doctest and one +unittest). These will both pass when you run "manage.py test". + +Replace these with more appropriate tests for your application. +""" + +from django.test import TestCase + +class SimpleTest(TestCase): + def test_basic_addition(self): + """ + Tests that 1 + 1 always equals 2. + """ + self.failUnlessEqual(1 + 1, 2) + +__test__ = {"doctest": """ +Another way to test that 1 + 1 is equal to 2. + +>>> 1 + 1 == 2 +True +"""} + diff --git a/itf/app/views.py b/itf/app/views.py new file mode 100644 index 0000000..9ea4157 --- /dev/null +++ b/itf/app/views.py @@ -0,0 +1,23 @@ +from django.template import RequestContext +from django.conf import settings +from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404 + +from ox.django.shortcuts import json_response, render_to_json_response, get_object_or_404_json + +from api.views import html_snapshot + + +def index(request): + context = RequestContext(request, {'settings':settings}) + if request.GET.get('_escaped_fragment_', None): + return html_snapshot(request) + return render_to_response('index.html', context) + +def site_json(request): + data = { + 'site': { + 'name': 'India Theatre Forum.' + } + } + return render_to_json_response(data) + diff --git a/itf/bestpractices/admin.py b/itf/bestpractices/admin.py new file mode 100644 index 0000000..78eed6f --- /dev/null +++ b/itf/bestpractices/admin.py @@ -0,0 +1,4 @@ +from django.contrib import admin +from models import * + +admin.site.register(BestPractice) diff --git a/itf/erang_organised/views.py b/itf/erang_organised/views.py index 52dbbd6..b5c3101 100644 --- a/itf/erang_organised/views.py +++ b/itf/erang_organised/views.py @@ -6,7 +6,7 @@ import urllib2 from django.http import HttpResponse from django.core.mail import send_mail from django.db.models import Q -from oxdjango.shortcuts import render_to_json_response +from ox.django.shortcuts import render_to_json_response from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.template import RequestContext diff --git a/itf/settings.py b/itf/settings.py index f06702d..973e0d8 100644 --- a/itf/settings.py +++ b/itf/settings.py @@ -3,6 +3,7 @@ import os from os.path import join +SITENAME = "India Theatre Forum" DEBUG = True TEMPLATE_DEBUG = DEBUG JSON_DEBUG = DEBUG @@ -125,6 +126,7 @@ INSTALLED_APPS = ( 'festival', 'erang_organised', 'scriptbank', + 'bestpractices', # 'solango', 'multilingual', # 'multilingual.flatpages', diff --git a/itf/static/js/itf.js b/itf/static/js/itf.js new file mode 100644 index 0000000..28453e8 --- /dev/null +++ b/itf/static/js/itf.js @@ -0,0 +1,565 @@ + + +var app = new Ox.App({ + apiURL: '/api/', + init: 'hello', + config: 'site.json' //FIXME: shouldn't need this, get data with 'hello' or 'init'. +}); + +app.launch(function(data) { + Ox.print(data); + + app.$body = $('body'); + app.$document = $(document); + app.$window = $(window); +/* + app.user = data.user; + app.config = data.config; +*/ + +/* + //FIXME: should this be a nested structure as their representation on the page? + app.constructors = ['wrapper', 'headerPanel', 'mainPanel', 'leftPanel', 'cityPicker', 'calendarBox', 'currentEventsList', 'middlePanel', 'middleTopPanel', 'newsfeedBox', 'aboutBox', 'itfBox', 'middleBottomPanel', 'erangBox', 'scriptArchiveBox', 'bestPracticesBox', 'biblioBox', 'offersNeedsBox', 'surveysBox', 'rightPanel', 'searchBox', 'loginBox', 'featureBox', 'footerPanel'] +*/ + + app.$ui = {}; +/* + Ox.each(app.constructors, function(i, v) { + app.$ui[v] = app.construct[v](); + }); +*/ + var wrapper = app.construct.wrapper(); + app.$body.css({'opacity': 0}); + wrapper.appendTo(app.$body); + app.$body.animate({ + 'opacity': 1 + }, 2000); + + +/* + //FIXME: make sure to add a loading icon + Ox.Request.requests() && app.$ui.loadingIcon.start(); + Ox.Event.bind('', 'requestStart', function() { + Ox.print('requestStart') + app.$ui.loadingIcon.start(); + }); + Ox.Event.bind('', 'requestStop', function() { + Ox.print('requestStop') + app.$ui.loadingIcon.stop(); + }); +*/ + +// $(body).append(app.$ui.wrapper); + +}); + + +app.construct = { +/* +Structure: + wrapper + headerPanel + homeBox + searchBox + mainPanel + leftPanel + cityPicker + calendarBox + currentEventsList + middlePanel + middleTopPanel + newsfeedBox + aboutBox + itfBox + middleMiddlePanel + erangBox + scriptArchiveBox + bestPracticesBox + middleBottomPanel + biblioBox + offersNeedsBox + surveysBox + rightPanel + loginBox + featureBox + footerPanel +*/ + + + 'wrapper': function() { + var id = 'wrapper'; + // Constructs overall wrapper for the page, and should be appended to $(body) + return app.$ui[id] = new Ox.SplitPanel({ + id: id, + orientation: 'vertical', + elements: [ + { + element: app.construct.headerPanel(), + size: 40 + }, + { + element: app.construct.mainPanel(), + }, + { + element: app.construct.footerPanel(), + size: 40 + } + ] + }); + }, + +/* +BEGIN headerPanel +*/ + 'headerPanel': function() { + var id = 'headerPanel'; + var p = app.$ui[id] = new Ox.SplitPanel({ + orientation: 'horizontal', + id: id, + elements: [ + { + element: app.construct.homeBox(), + }, + { + element: app.construct.searchBox(), + size: 128 + + } + ] + }); + return p; + }, + + 'homeBox': function() { + var id = 'homeBox'; + var c = app.$ui.homeBox = new Ox.Container({ + id: id + }); + c.$content.html("This is the header - maybe load from a template?"); + return c; + }, + + 'searchBox': function() { + var id = 'searchBox'; + var i = app.$ui.searchBox = new Ox.Input({ + 'id': id, + 'placeholder': 'Search' + }); + i.bindEvent("submit", function(val) { + Ox.print("Should be doing a search"); + }); + return i; + }, + +/* +END headerPanel +*/ + +/* +BEGIN mainPanel +*/ + + 'mainPanel': function() { + var id = 'mainPanel'; + var p = app.$ui[id] = new Ox.SplitPanel({ + id: id, + orientation: 'horizontal', + elements: [ + { + element: app.construct.leftPanel(), + size: 256, + resizable: true, + resize: [0, 128, 256, 384] + }, + { + element: app.construct.middlePanel(), + resizable: true + }, + { + element: app.construct.rightPanel(), + size: 256, + resizable: true, + resize: [0, 128, 256, 384] + } + ] + }); + return p; + }, + + /* + BEGIN leftPanel + */ + 'leftPanel': function() { + var id = 'leftPanel'; + var p = app.$ui[id] = new Ox.SplitPanel({ + id: id, + orientation: 'vertical', + elements: [ + { + element: app.construct.cityPicker(), + size: 40 + }, + { + element: app.construct.calendarBox() + }, + { + element: app.construct.currentEventsList(), + size: 300 + } + ] + }); + return p; + }, + + 'cityPicker': function() { + var id = 'cityPicker'; + var i = app.$ui[id] = new Ox.Input({ + id: id, + placeholder: 'Chose Your City' + }); + i.submit(function(val) { + Ox.Print("should handle submit of city name"); + }); + return i; + }, + + 'calendarBox': function() { + var id = 'calendarBox'; + var c = app.$ui[id] = new Ox.Container({ + id: id + }); + c.$content.html("somehow, the bookmyshow calendar goes here."); + return c; + }, + + 'currentEventsList': function() { + var id = 'currentEventsList'; + var c = app.$ui[id] = new Ox.Container({ + id: id + }); + c.$content.html("List of current events"); + return c; + }, + /* + END leftPanel + */ + + /* + BEGIN middlePanel + */ + 'middlePanel': function() { + var id = 'middlePanel'; + var p = app.$ui[id] = new Ox.SplitPanel({ + orientation: 'vertical', + id: id, + elements: [ + { + element: app.construct.middleTopPanel(), + size: 128, + resizable: true, + resize: [0, 64, 128, 196, 256], + collapsible: true + }, + { + element: app.construct.middleMiddlePanel(), + collapsible: true + }, + { + element: app.construct.middleBottomPanel(), + size: 128, + resizable: true, + resize: [0, 64, 128, 196, 256], + collapsible: true + } + ] + }); + return p; + }, + + /* + BEGIN middleTopPanel + */ + 'middleTopPanel': function() { + var id = 'middleTopPanel'; + var p = app.$ui[id] = new Ox.SplitPanel({ + id: id, + orientation: 'horizontal', + elements: [ + { + element: app.construct.newsfeedBox(), + size: 256 + }, + { + element: app.construct.aboutBox() + }, + { + element: app.construct.itfBox(), + size: 256 + } + ] + }); + return p; + }, + + 'newsfeedBox': function() { + var id = 'newsfeedBox'; + var c = app.$ui[id] = new Ox.ItfBox({ + id: id, + title: 'ITF NewsFeed' + }); + for (var i=0; i<25; i++) { + var content = new Ox.Element().html('newsfeed content goes here'); + c.$content.append(content); + } + return c; + }, + + 'aboutBox': function() { + var id = 'aboutBox'; + var c = app.$ui[id] = new Ox.Container({ + id: id + }); + c.$content.html("about goes here"); + return c; + }, + + 'itfBox': function() { + var id = 'itfBox'; + var c = app.$ui[id] = new Ox.Container({ + id: id + }); + c.$content.html("about itf goes here"); + return c; + }, + /* + END middleTopPanel + */ + + /* + BEGIN middleMiddlePanel + */ + + 'middleMiddlePanel': function() { + var id = 'middleMiddlePanel'; + var p = app.$ui[id] = new Ox.SplitPanel({ + id: id, + orientation: 'horizontal', + elements: [ + { + element: app.construct.erangBox(), + size: 256 + }, + { + element: app.construct.scriptArchiveBox() + }, + { + element: app.construct.bestPracticesBox(), + size: 256 + } + ] + }); + return p; + }, + + 'erangBox': function() { + var id = 'erangBox'; + var c = app.$ui[id] = new Ox.Container({ + id: id + }); + c.$content.html("erang goes here"); + return c; + }, + + 'scriptArchiveBox': function() { + var id = 'scriptArchiveBox'; + var c = app.$ui[id] = new Ox.Container({ + id: id + }); + c.$content.html("script archive goes here"); + return c; + }, + + 'bestPracticesBox': function() { + var id = 'bestPracticesBox'; + var c = app.$ui[id] = new Ox.Container({ + id: id + }); + c.$content.html("best practices goes here"); + return c; + }, + + /* + END middleMiddlePanel + */ + + /* + BEGIN middleBottomPanel + */ + 'middleBottomPanel': function() { + var id = 'middleBottomPanel'; + var p = app.$ui[id] = new Ox.SplitPanel({ + id: id, + orientation: 'horizontal', + elements: [ + { + element: app.construct.biblioBox(), + size: 256 + }, + { + element: app.construct.offersNeedsBox() + }, + { + element: app.construct.surveysBox(), + size: 256 + } + ] + }); + return p; + }, + + 'biblioBox': function() { + var id = 'biblioBox'; + var c = app.$ui[id] = new Ox.Container({ + id: id + }); + c.$content.html("biblioBox here"); + return c; + }, + + 'offersNeedsBox': function() { + var id = 'offersNeedsBox'; + var c = app.$ui[id] = new Ox.Container({ + id: id + }); + c.$content.html("offers and needs here"); + return c; + }, + + 'surveysBox': function() { + var id = 'surveysBox'; + var c = app.$ui[id] = new Ox.Container({ + id: id + }); + c.$content.html("surveys go here"); + return c; + }, + + /* + END middleBottomPanel + */ + + /* + END middlePanel + */ + + /* + BEGIN rightPanel + */ + + 'rightPanel': function() { + var id = 'rightPanel'; + var p = app.$ui[id] = new Ox.SplitPanel({ + id: id, + orientation: 'vertical', + elements: [ + { + element: app.construct.loginBox(), + size: 256 + }, + { + element: app.construct.featureBox() + } + ] + }); + return p; + }, + + 'loginBox': function() { + var id = 'loginBox'; + var c = app.$ui[id] = new Ox.Container({ + id: id + }); + c.$content.html("login goes here"); + return c; + }, + + 'featureBox': function() { + var id = 'featureBox'; + var c = app.$ui[id] = new Ox.Container({ + id: id + }); + c.$content.html("featured profile here"); + return c; + }, + + /* + END rightPanel + */ + +/* +END mainPanel +*/ + +/* +BEGIN footerPanel +*/ + 'footerPanel': function() { + var id = 'footerPanel'; + var c = app.$ui[id] = new Ox.Container({ + id: id + }); + c.$content.html("footer goes here"); + return c; + } +/* +END footerPanel +*/ +} + + + +/* +Ox.Box - generic box element, with a bar, some help, possibility for a short menu, and should some-how be able to contain items / elements. + +*/ + +Ox.ItfBox = function(options, self) { + var self = self || {}; + var that = new Ox.Container(options, self) + .defaults({ + 'title': '' + }) + .options(options); + var title = self.options.title; + var $titlebar = new Ox.Bar({ + orientation: 'horizontal', + size: 16 + }) +// .dblclick(dblclickTitlebar) + .appendTo(that.$content), + +/* + $switch = new Ox.Button({ + id: options.id + 'Switch', + style: 'symbol', + title: title, + type: 'image', + }) +// .click(toggleCollapsed) + .appendTo($titlebar), +*/ + $title = new Ox.Element() + .addClass('OxTitle') + .html(title/*.toUpperCase()*/) + .appendTo($titlebar); + +// $buttons = new Ox. + return that; +} + + + + + + + diff --git a/itf/static/js/jquery/jquery.tmpl.min.js b/itf/static/js/jquery/jquery.tmpl.min.js new file mode 100644 index 0000000..f08e81d --- /dev/null +++ b/itf/static/js/jquery/jquery.tmpl.min.js @@ -0,0 +1 @@ +(function(a){var r=a.fn.domManip,d="_tmplitem",q=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,b={},f={},e,p={key:0,data:{}},h=0,c=0,l=[];function g(e,d,g,i){var c={data:i||(d?d.data:{}),_wrap:d?d._wrap:null,tmpl:null,parent:d||null,nodes:[],calls:u,nest:w,wrap:x,html:v,update:t};e&&a.extend(c,e,{nodes:[],parent:d});if(g){c.tmpl=g;c._ctnt=c._ctnt||c.tmpl(a,c);c.key=++h;(l.length?f:b)[h]=c}return c}a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(f,d){a.fn[f]=function(n){var g=[],i=a(n),k,h,m,l,j=this.length===1&&this[0].parentNode;e=b||{};if(j&&j.nodeType===11&&j.childNodes.length===1&&i.length===1){i[d](this[0]);g=this}else{for(h=0,m=i.length;h0?this.clone(true):this).get();a.fn[d].apply(a(i[h]),k);g=g.concat(k)}c=0;g=this.pushStack(g,f,i.selector)}l=e;e=null;a.tmpl.complete(l);return g}});a.fn.extend({tmpl:function(d,c,b){return a.tmpl(this[0],d,c,b)},tmplItem:function(){return a.tmplItem(this[0])},template:function(b){return a.template(b,this[0])},domManip:function(d,l,j){if(d[0]&&d[0].nodeType){var f=a.makeArray(arguments),g=d.length,i=0,h;while(i1)f[0]=[a.makeArray(d)];if(h&&c)f[2]=function(b){a.tmpl.afterManip(this,b,j)};r.apply(this,f)}else r.apply(this,arguments);c=0;!e&&a.tmpl.complete(b);return this}});a.extend({tmpl:function(d,h,e,c){var j,k=!c;if(k){c=p;d=a.template[d]||a.template(null,d);f={}}else if(!d){d=c.tmpl;b[c.key]=c;c.nodes=[];c.wrapped&&n(c,c.wrapped);return a(i(c,null,c.tmpl(a,c)))}if(!d)return[];if(typeof h==="function")h=h.call(c||{});e&&e.wrapped&&n(e,e.wrapped);j=a.isArray(h)?a.map(h,function(a){return a?g(e,c,d,a):null}):[g(e,c,d,h)];return k?a(i(c,null,j)):j},tmplItem:function(b){var c;if(b instanceof a)b=b[0];while(b&&b.nodeType===1&&!(c=a.data(b,"tmplItem"))&&(b=b.parentNode));return c||p},template:function(c,b){if(b){if(typeof b==="string")b=o(b);else if(b instanceof a)b=b[0]||{};if(b.nodeType)b=a.data(b,"tmpl")||a.data(b,"tmpl",o(b.innerHTML));return typeof c==="string"?(a.template[c]=b):b}return c?typeof c!=="string"?a.template(null,c):a.template[c]||a.template(null,q.test(c)?c:a(c)):null},encode:function(a){return(""+a).split("<").join("<").split(">").join(">").split('"').join(""").split("'").join("'")}});a.extend(a.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){_=_.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(_,$1,$2);_=[];",close:"call=$item.calls();_=call._.concat($item.wrap(call,_));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){_.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){_.push($.encode($1a));}"},"!":{open:""}},complete:function(){b={}},afterManip:function(f,b,d){var e=b.nodeType===11?a.makeArray(b.childNodes):b.nodeType===1?[b]:[];d.call(f,b);m(e);c++}});function i(e,g,f){var b,c=f?a.map(f,function(a){return typeof a==="string"?e.key?a.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+d+'="'+e.key+'" $2'):a:i(a,e,a._ctnt)}):e;if(g)return c;c=c.join("");c.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(f,c,e,d){b=a(e).get();m(b);if(c)b=j(c).concat(b);if(d)b=b.concat(j(d))});return b?b:j(c)}function j(c){var b=document.createElement("div");b.innerHTML=c;return a.makeArray(b.childNodes)}function o(b){return new Function("jQuery","$item","var $=jQuery,call,_=[],$data=$item.data;with($data){_.push('"+a.trim(b).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(m,l,j,d,b,c,e){var i=a.tmpl.tag[j],h,f,g;if(!i)throw"Template command not found: "+j;h=i._default||[];if(c&&!/\w$/.test(b)){b+=c;c=""}if(b){b=k(b);e=e?","+k(e)+")":c?")":"";f=c?b.indexOf(".")>-1?b+c:"("+b+").call($item"+e:b;g=c?f:"(typeof("+b+")==='function'?("+b+").call($item):("+b+"))"}else g=f=h.$1||"null";d=k(d);return"');"+i[l?"close":"open"].split("$notnull_1").join(b?"typeof("+b+")!=='undefined' && ("+b+")!=null":"true").split("$1a").join(g).split("$1").join(f).split("$2").join(d?d.replace(/\s*([^\(]+)\s*(\((.*?)\))?/g,function(d,c,b,a){a=a?","+a+")":b?")":"";return a?"("+c+").call($item"+a:d}):h.$2||"")+"_.push('"})+"');}return _;")}function n(c,b){c._wrap=i(c,true,a.isArray(b)?b:[q.test(b)?b:a(b).html()]).join("")}function k(a){return a?a.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function s(b){var a=document.createElement("div");a.appendChild(b.cloneNode(true));return a.innerHTML}function m(o){var n="_"+c,k,j,l={},e,p,i;for(e=0,p=o.length;e=0;i--)m(j[i]);m(k)}function m(j){var p,i=j,k,e,m;if(m=j.getAttribute(d)){while(i.parentNode&&(i=i.parentNode).nodeType===1&&!(p=i.getAttribute(d)));if(p!==m){i=i.parentNode?i.nodeType===11?0:i.getAttribute(d)||0:0;if(!(e=b[m])){e=f[m];e=g(e,b[i]||f[i],null,true);e.key=++h;b[h]=e}c&&o(m)}j.removeAttribute(d)}else if(c&&(e=a.data(j,"tmplItem"))){o(e.key);b[e.key]=e;i=a.data(j.parentNode,"tmplItem");i=i?i.key:0}if(e){k=e;while(k&&k.key!=i){k.nodes.push(j);k=k.parent}delete e._ctnt;delete e._wrap;a.data(j,"tmplItem",e)}function o(a){a=a+n;e=l[a]=l[a]||g(e,b[e.parent.key+n]||e.parent,null,true)}}}function u(a,d,c,b){if(!a)return l.pop();l.push({_:a,tmpl:d,item:this,data:c,options:b})}function w(d,c,b){return a.tmpl(a.template(d),c,b,this)}function x(b,d){var c=b.options||{};c.wrapped=d;return a.tmpl(a.template(b.tmpl),b.data,c,b.item)}function v(d,c){var b=this._wrap;return a.map(a(a.isArray(b)?b.join(""):b).filter(d||"*"),function(a){return c?a.innerText||a.textContent:a.outerHTML||s(a)})}function t(){var b=this.nodes;a.tmpl(null,null,null,this).insertBefore(b[0]);a(b).remove()}})(jQuery) \ No newline at end of file diff --git a/itf/templates/index.html b/itf/templates/index.html index fc856cf..fa1f08e 100755 --- a/itf/templates/index.html +++ b/itf/templates/index.html @@ -1 +1,23 @@ -Welcome :-) + + + + India Theatre Forum + + + + + + + + + + + + + + diff --git a/itf/urls.py b/itf/urls.py index e45755d..00d7be9 100644 --- a/itf/urls.py +++ b/itf/urls.py @@ -17,6 +17,9 @@ urlpatterns = patterns('', (r'^ckeditor/', include('ckeditor.urls')), (r'^robots.txt$', direct_to_template, {'template': 'robots.txt', 'mimetype': 'text/plain'}), (r'^erang/', include('erang_organised.urls')), + (r'api/', 'api.views.api'), + (r'jsdoc/', 'api.views.jsdoc'), + (r'site.json', 'app.views.site_json'), (r'^itf/$', 'festival.views.home'), (r'^itf/wireframe', 'festival.views.wireframe'), (r'^itf/projects', 'festival.views.projects'), @@ -39,19 +42,22 @@ urlpatterns = patterns('', # (r'profile', 'itfcore.views.edit_profile'), (r'i/', include('itfcore.urls')), (r'^admin/doc/', include('django.contrib.admindocs.urls')), - (r'^mockup/', 'itfcore.views.mockup'), - (r'x0news/', 'itfcore.views.allnews'), - (r'x0disc/', 'itfcore.views.disc'), - (r'x0multi/', 'itfcore.views.multi'), - (r'x0resources/', 'itfcore.views.resources'), - (r'x0erang/', 'itfcore.views.erang'), - (r'x0profile/', 'itfcore.views.profile'), + +# (r'^mockup/', 'itfcore.views.mockup'), +# (r'x0news/', 'itfcore.views.allnews'), +# (r'x0disc/', 'itfcore.views.disc'), +# (r'x0multi/', 'itfcore.views.multi'), +# (r'x0resources/', 'itfcore.views.resources'), +# (r'x0erang/', 'itfcore.views.erang'), +# (r'x0profile/', 'itfcore.views.profile'), (r'googlehostedservice.html', 'itfcore.views.googlehosted'), + (r'emailsignuplist', 'festival.views.email_signups'), (r'^favicon.ico$', 'django.views.generic.simple.redirect_to', {'url': '/static/images/favicon.ico'}), # (r'^ajax_filtered_fields/', include('ajax_filtered_fields.urls')), # Uncomment the next line to enable the admin: + (r'^test$', 'app.views.index'), (r'^$', 'festival.views.home') ) diff --git a/requirements.txt b/requirements.txt index 6f5a2ff..7010682 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -e svn+http://code.djangoproject.com/svn/django/branches/releases/1.2.X/#egg=django --e bzr+http://code.0xdb.org/python-oxdjango/#egg=python-oxdjango +-e bzr+http://code.0x2620.org/python-ox/#egg=python-ox -e svn+http://django-multilingual.googlecode.com/svn/trunk/#egg=multilingual -e bzr+http://firefogg.org/dev/python-firefogg/#egg=python-firefogg -e bzr+http://firefogg.org/dev/django_firefogg/#egg=django_firefogg