From fb0f193ea477b849200992415f45c1b06aa00043 Mon Sep 17 00:00:00 2001 From: Jeremy Muhlich Date: Sun, 7 Nov 2010 01:17:44 -0400 Subject: [PATCH] made uploads work --- js/main.js | 7 +++---- room.py | 4 +++- templates/room.html | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/js/main.js b/js/main.js index 0d0a426..f987b0a 100644 --- a/js/main.js +++ b/js/main.js @@ -252,14 +252,13 @@ var chat = function() { flash_swf_url: '/js/plupload/plupload.flash.swf', multi_selection:false, }); - + uploader.init(); uploader.bind('FilesAdded', function(up, files) { - if(uploader.state!=2 & files.length>0){ - uploader.start(); + if(up.state!=2 & files.length>0){ + up.start(); } }); - uploader.init(); // apply jquery hooks and behaviors $('#room-topic').editable('/api/room/' + room.key + '/topic', { diff --git a/room.py b/room.py index 3d1fba0..48638c8 100644 --- a/room.py +++ b/room.py @@ -99,8 +99,10 @@ def post(self, room_key): timestamp = datetime.now() account = get_account() room = Room.all().filter('__key__ =', Key(room_key)).get() + blob_key = str(blob_info.key()) + content = self.request.application_url + "/room/" + str(room_key) + "/download/" + blob_key message = Message(sender=account, room=room, timestamp=timestamp, - event=Message_event_codes['upload'], content="http://localhost.com:8080/room/" + str(room_key) + "/download/" + str(blob_info.key()), extra=str(blob_info.key)) + event=Message_event_codes['upload'], content=content, extra=blob_key) message.put() self.redirect('/room/' + str(room_key) +'/upload/%s/success' % blob_info.key()) diff --git a/templates/room.html b/templates/room.html index ddf3f9b..042a10e 100644 --- a/templates/room.html +++ b/templates/room.html @@ -58,5 +58,5 @@

Upload:

{% block script %} the_room = { key: '{{ room.key }}', name: '{{ room.name }}' }; the_account = { nickname: '{{ account.nickname }}' }; -chat.initialize(the_room, the_account, '{{ upload_url }}',' {{ message_last_key }}'); +chat.initialize(the_room, the_account, '{{ upload_url }}','{{ message_last_key }}'); {% endblock %}