Skip to content

Commit

Permalink
made uploads work
Browse files Browse the repository at this point in the history
  • Loading branch information
jmuhlich committed Nov 7, 2010
1 parent 400f874 commit fb0f193
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 3 additions & 4 deletions js/main.js
Expand Up @@ -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', {
Expand Down
4 changes: 3 additions & 1 deletion room.py
Expand Up @@ -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())

Expand Down
2 changes: 1 addition & 1 deletion templates/room.html
Expand Up @@ -58,5 +58,5 @@ <h3 id="room-fileuploads">Upload:</h3>
{% 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 %}

0 comments on commit fb0f193

Please sign in to comment.