diff options
| -rw-r--r-- | backend/views.py | 18 | ||||
| -rw-r--r-- | frontend/templates/profile_img.html | 152 | ||||
| -rw-r--r-- | frontend/views.py | 30 | ||||
| -rw-r--r-- | scannerjammer/urls.py | 1 |
4 files changed, 201 insertions, 0 deletions
diff --git a/backend/views.py b/backend/views.py index 7cfbe98..4ea7b2d 100644 --- a/backend/views.py +++ b/backend/views.py @@ -167,6 +167,24 @@ def videos_response_list(videos): ] retval.append(l) return retval +def text_response_list(videos): + """ Return list of videos + """ + retval = [] + for v in videos: + s = v.settings + if s.get('removed', 0): + continue + l = [ + v.id, + datetime_to_timestamp(v.datetime), + v.user.id, + v.user.username, + s['text'], + v.sjlike_set.count() + ] + retval.append(l) + return retval def settings_response_str(label, settings): """ Return string of settings diff --git a/frontend/templates/profile_img.html b/frontend/templates/profile_img.html new file mode 100644 index 0000000..4b2feb3 --- /dev/null +++ b/frontend/templates/profile_img.html @@ -0,0 +1,152 @@ +{% load static %} +{% get_static_prefix as STATIC_PREFIX %} +<!doctype html> +<html> +<head> +<title>scanners jammed by {{NAME}}</title> +<link rel="shortcut icon" href="{{ STATIC_PREFIX }}/favicon.ico" /> +<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> +<meta property="og:title" content="{{NAME}}'s profile on ScannerJammer"/> +<meta property="og:type" content="website"/> +<meta property="og:url" content="{{ STATIC_PREFIX }}/profile/{{NAME}}/"/> +<meta property="og:image" content="{{THUMBNAIL}}"/> +<meta property="og:site_name" content="ScannerJammer"/> +<meta property="og:description" content="Youtube video chat"/> +<meta property="fb:admins" content="100001923956223,1709246"/> +<meta name="description" content="Youtube video chat" /> +<link href="{{ STATIC_PREFIX }}/css/sasscss/profile.css" media="screen, projection" rel="stylesheet" type="text/css" /> +<link href="{{ STATIC_PREFIX }}/css/sasscss/print.css" media="print" rel="stylesheet" type="text/css" /> +<!--[if IE]> + <link href="/css/sasscss/ie.css" media="screen, projection" rel="stylesheet" type="text/css" /> +<![endif]--> +</head> +<body> +<div id="logo"> + <a href="/"><img src="{{ STATIC_PREFIX }}/img/scanjam-title.gif" width="347" height="44" id="scanjam" border="0" /></a> + <h2> + Use arrow keys to switch videos<br/> + Hit L key to LIKE<br/> + Hit ESC to switch views + </h2> + <h1 id="header">{{UCNAME}} score:{{SCORE}}</h1> +</div> +<div id="logobg"></div> + +<div id="flower"><img src="{{ STATIC_PREFIX }}/img/flower-red.gif" height="400" /></div> + +<div id="player"> + <div id="projector"> + <div id="screen"></div> + <div id="ytscreen"></div> + <div id="video-title"></div> + </div> + <nav id="controls"> + <button id="prev"><<</button> + <button id="pause">||</button> + <button id="next">>></button> + <button id="scan">SCAN</button> + <button id="like">LIKE</button> + <button id="fullscreen">FULLSCREEN</button> + <a id="video-link" target="_blank">[link]</a> + <span id="sharebutton" class="st_sharethis" st_url="{{ STATIC_PREFIX }}/" st_title="Scanner Jammer"></span> + </nav> +</div> + +<div id="playlistbg"></div> +<div id="playlist"> + <ol id="queueLinks"></ol> + <ul id="queue"></ul> +</div> + +<div id="contact"> + <img src="{{ STATIC_PREFIX }}/img/runner.gif" class="avatar"> + <p id="bio"></p> + <img src="{{ STATIC_PREFIX }}/img/runner.gif" class="avatar"> +</div> + +<div id="bg"> + <img src="" /> +</div> + +<div id="sitez"> + <div id="settings-hook">EDIT YOUR PROFILE</div> + <div> + <a href="/top/">Top Videos</a> . + <a href="/directory/">Directory</a> + </div> + <div id="likebutton"> +<!-- + <fb:like href="{{ STATIC_PREFIX }}/" layout="button_count" show_faces="false" width="90" font=""></fb:like> +--> +<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.scannerjammer.fm%2F&layout=button_count&show_faces=false&width=450&action=like&font=tahoma&colorscheme=light&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"id="fblike"></iframe> + </div> +</div> + +<div id="settings-container"> + <div id="settings-close" class="close">X</div> + <h5>EDITING {{UCNAME}}</h5> + <div class="shim"></div> + <label>background URL</label> + <input type="text" id="profile-bg"> + <div class="shim"></div> + + <label>corner image URL</label> + <input type="text" id="profile-avatar"><br/> + <div class="shim"></div> + + <label>enter your contact info here, you can also paste links to GIFs and images</label> + <textarea id="profile-bio"></textarea><br/> + <div class="shim"></div> + + <label> </label><button id="profile-settings-save">save</button><br /> + <div class="shim"></div> + <div class="shim"></div> +</div> + +<div id="gif-container"> + <div id="gifs"></div> +</div> + +<div id="msg"></div> +<div id="plea"> + please enable javascript +</div> + +<div id="fullscreen-warning">Hit Escape to exit fullscreen mode</div> + +</body> +{{LIKEZ|safe}} +<script type="text/javascript">document.getElementById("plea").style.display="none"</script> +<script type="text/javascript"> + serverHost = "{{SERVER_HOST}}" + serverPort = 80 +var likeContentQueue = {{LIKEZ|safe}} +var likeContentQueueTitle = "jams i like" +var userProfile = {{PROFILE|safe}} +var now = {{NOW}} +</script> +<script type="text/javascript" src="{{ STATIC_PREFIX }}/js/jquery-1.5.2.min.js"></script> +<script type="text/javascript" src="{{ STATIC_PREFIX }}/js/jquery.md5.js"></script> +<script type="text/javascript" src="{{ STATIC_PREFIX }}/js/swfobject.js"></script> +<script type="text/javascript" src="{{ STATIC_PREFIX }}/js/soundmanager2.js"></script> +<!--not sure what debug is --> +<script type="text/javascript" src="{{ STATIC_PREFIX }}/js/debug.js"></script> +<script type="text/javascript" src="{{ STATIC_PREFIX }}/js/api.js"></script> +<script type="text/javascript" src="{{ STATIC_PREFIX }}/js/auth.js"></script> +<!--really not sure why chat and like are here --> +<script type="text/javascript" src="{{ STATIC_PREFIX }}/js/like.js"></script> +<script type="text/javascript" src="{{ STATIC_PREFIX }}/js/chat.js"></script> +<script type="text/javascript" src="{{ STATIC_PREFIX }}/js/player.js"></script> +<script type="text/javascript" src="{{ STATIC_PREFIX }}/js/vimeo.js"></script> +<script type="text/javascript" src="{{ STATIC_PREFIX }}/js/youtube.js"></script> +<script type="text/javascript" src="{{ STATIC_PREFIX }}/js/soundcloud.js"></script> +<script type="text/javascript" src="{{ STATIC_PREFIX }}/js/audio.js"></script> +<!-- I guess the probz you were talking about would be in profile.js --> +<script type="text/javascript" src="{{ STATIC_PREFIX }}/js/profile.js"></script> +<!-- +<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script> +<script type="text/javascript">stLight.options({publisher:'12cf4ab4-b19f-44d7-81ac-9454fd7334b0',onhover:false});</script> +--> +<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script> +</html> + diff --git a/frontend/views.py b/frontend/views.py index f9dd1bf..763253e 100644 --- a/frontend/views.py +++ b/frontend/views.py @@ -19,6 +19,7 @@ from backend.models import SJUserProfile from backend.views import is_number from backend.views import is_image from backend.views import videos_response_list +from backend.views import text_response_list from backend.views import ROOM_VIDEO_LOG_SIZE from django.db.models import Q, Count @@ -173,6 +174,35 @@ def profile(request, username): response['Pragma'] = 'no-cache' return response +def profile_img(request, username): + """ Directory view + """ + + userprofile = SJUserProfile.objects.filter(user__username=username)[0]; + thumbnail = get_thumbnail(userprofile) + + likez = SJContent.objects.filter(content_type='text', sjlike__user_id = userprofile.user.id ).order_by('-datetime')[:50] + profile = [ userprofile.id, userprofile.nickname, userprofile.score, 3, 4, 5, userprofile.bio, json.loads(userprofile.settings_text) ] + + response = render_to_response( + 'profile_img.html', + { + 'SERVER_HOST': request.get_host(), + 'SERVER_PORT': settings.SERVER_PORT, + 'NAME': userprofile.nickname, + 'UCNAME': userprofile.nickname.upper(), + 'SCORE': userprofile.score, + 'THUMBNAIL': thumbnail, + + 'LIKEZ': json.dumps(text_response_list(likez)), + 'PROFILE': json.dumps(profile), + + 'NOW': str(int(time.time())), + } + ) + response['Pragma'] = 'no-cache' + return response + def profile_own(request): return profile(request, request.user.username) diff --git a/scannerjammer/urls.py b/scannerjammer/urls.py index e1b3450..c3c08c3 100644 --- a/scannerjammer/urls.py +++ b/scannerjammer/urls.py @@ -29,6 +29,7 @@ urlpatterns = patterns('', url(r'^register/?$', 'frontend.views.register', name='register'), url(r'^(?P<roomname>[a-z0-9_]+)/admin/?$', 'frontend.views.admin', name='admin'), url(r'^profile/(?P<username>[a-z0-9_]+)$', 'frontend.views.profile', name='profile'), + url(r'^profile_img/(?P<username>[a-z0-9_]+)$', 'frontend.views.profile_img', name='profile_img'), url(r'^profile/?$', 'frontend.views.profile_own', name='profile_own'), url(r'^(?P<roomname>avatar)/$', 'frontend.views.room', name='room'), url(r'^(?P<roomname>[a-z0-9_]+)$', 'frontend.views.room', name='room'), |
