missing files
authorŁukasz Anwajler <lukasz@anwajler.com>
Thu, 24 Feb 2011 10:15:57 +0000 (11:15 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Thu, 24 Feb 2011 10:16:16 +0000 (11:16 +0100)
apps/api/handlers.py
apps/api/urls.py
apps/api/views.py [new file with mode: 0644]
apps/catalogue/views.py
apps/piston/templates/piston/authorize_token.html
wolnelektury/static/css/mobile.css [new file with mode: 0644]
wolnelektury/templates/auth/login.html
wolnelektury/urls.py

index ac47ac6..151af2d 100644 (file)
@@ -52,4 +52,4 @@ class BookHandler(BaseHandler):
             return rc.CREATED
         else:
             return rc.BAD_REQUEST
-"""
\ No newline at end of file
+"""
index 5fade25..beb4a7b 100644 (file)
@@ -24,4 +24,4 @@ urlpatterns += patterns(
     url(r'^oauth/request_token/$','oauth_request_token'),
     url(r'^oauth/authorize/$','oauth_user_auth'),
     url(r'^oauth/access_token/$','oauth_access_token'),
-)
\ No newline at end of file
+)
diff --git a/apps/api/views.py b/apps/api/views.py
new file mode 100644 (file)
index 0000000..1c5e848
--- /dev/null
@@ -0,0 +1,10 @@
+from django.http import HttpResponseRedirect
+
+def oauth_callback(request, data):
+    key       = data.key
+    secret    = data.secret
+    verifier  = data.verifier
+    timestamp = data.timestamp
+    print data
+    return HttpResponseRedirect("wl://")
+    #return HttpResponseRedirect("wl://%s/%s/%s/%s/" % (key, secret, verifier, timestamp))
index 7f1de6d..5de0e9d 100644 (file)
@@ -141,7 +141,7 @@ def differentiate_tags(request, tags, ambiguous_slugs):
                 context_instance=RequestContext(request))
 
 
-def tagged_object_list(request, tags=''):
+def tagged_object_list(request, tags='', api=False):
     try:
         tags = models.Tag.get_tag_list(tags)
     except models.Tag.DoesNotExist:
@@ -222,20 +222,23 @@ def tagged_object_list(request, tags=''):
         only_author = len(tags) == 1 and tags[0].category == 'author'
         objects = models.Book.objects.none()
 
-    return object_list(
-        request,
-        objects,
-        template_name='catalogue/tagged_object_list.html',
-        extra_context={
-            'categories': categories,
-            'only_shelf': only_shelf,
-            'only_author': only_author,
-            'only_my_shelf': only_my_shelf,
-            'formats_form': forms.DownloadFormatsForm(),
-
-            'tags': tags,
-        }
-    )
+    if api:
+        print objects
+        return objects    
+    else:
+        return object_list(
+            request,
+            objects,
+            template_name='catalogue/tagged_object_list.html',
+            extra_context={
+                'categories': categories,
+                'only_shelf': only_shelf,
+                'only_author': only_author,
+                'only_my_shelf': only_my_shelf,
+                'formats_form': forms.DownloadFormatsForm(),
+                'tags': tags,
+            }
+        )
 
 
 def book_fragments(request, book_slug, theme_slug):
@@ -680,6 +683,27 @@ def delete_shelf(request, slug):
 # ==================
 # = Authentication =
 # ==================
+
+@cache.never_cache
+def simple_login(request):
+    if request.method == "GET":
+        #next = request.REQUEST.get('next', '')
+        #if next == '':
+        form = AuthenticationForm(prefix='login')
+        return render_to_response('auth/login.html', locals(),
+                context_instance=RequestContext(request))
+        #else:
+        #    return HttpResponseRedirect("/"+next)
+            
+    elif request.method == "POST":
+        form = AuthenticationForm(data=request.POST, prefix='login')
+        if form.is_valid():
+            auth.login(request, form.get_user())   
+        url = request.META['HTTP_REFERER'].split("next=")[1]
+        url = url.replace("%3F","?").replace("%3D","=")
+        return HttpResponseRedirect(url)    
+
+
 @require_POST
 @cache.never_cache
 def login(request):
index d3ec588..3507e55 100644 (file)
@@ -14,4 +14,4 @@
             <input type="submit" value="{% trans "Confirm" %}" />
         </form>
        </body>
-</html>
\ No newline at end of file
+</html>
diff --git a/wolnelektury/static/css/mobile.css b/wolnelektury/static/css/mobile.css
new file mode 100644 (file)
index 0000000..2f04e65
--- /dev/null
@@ -0,0 +1,7 @@
+ul li {
+    list-style-type: none;
+}
+
+h1 {
+    font-size: 1em;
+}
index d3cf660..204cce6 100644 (file)
@@ -25,4 +25,4 @@
             </ul>
         </form>
     </body>
-</html>
\ No newline at end of file
+</html>
index 53e6429..0d61a36 100644 (file)
@@ -36,6 +36,7 @@ urlpatterns = patterns('',
     url(r'^admin/', include(admin.site.urls)),
 
     # Authentication
+    url(r'^users/simple_login/$', 'catalogue.views.simple_login', name='simple_login'),
     url(r'^uzytkownicy/zaloguj/$', 'catalogue.views.login', name='login'),
     url(r'^uzytkownicy/wyloguj/$', 'catalogue.views.logout_then_redirect', name='logout'),
     url(r'^uzytkownicy/utworz/$', 'catalogue.views.register', name='register'),