diff options
author | James Boisture <jboisture@jboisture-laptop.(none)> | 2010-07-29 18:05:01 (GMT) |
---|---|---|
committer | James Boisture <jboisture@jboisture-laptop.(none)> | 2010-07-29 18:05:01 (GMT) |
commit | 09e3eea7a72e9e2300b639f0356100c7b83b5dfb (patch) | |
tree | d3608997517daa0ae5f98e5bf5ba95c8e29520b9 /views | |
parent | b817158f554f7b3342ecfe3ce24d04e91abed3c3 (diff) |
made a lot of major changes because it has been a long time since I commited last. There are many new features. Also added app.yaml file which should be placed in the web2py directly in order for the URL to work properly.
Diffstat (limited to 'views')
-rw-r--r-- | views/default/_base.html | 12 | ||||
-rw-r--r-- | views/default/admin.html | 33 | ||||
-rw-r--r-- | views/default/delete_image_confirmation.html | 5 | ||||
-rw-r--r-- | views/default/friends.html | 27 | ||||
-rw-r--r-- | views/default/image.html | 25 | ||||
-rw-r--r-- | views/default/index.html | 24 | ||||
-rw-r--r-- | views/default/profile.html | 42 | ||||
-rw-r--r-- | views/default/requests.html | 13 |
8 files changed, 168 insertions, 13 deletions
diff --git a/views/default/_base.html b/views/default/_base.html index a277d77..061186f 100644 --- a/views/default/_base.html +++ b/views/default/_base.html @@ -7,10 +7,16 @@ <div id="header"> <h1><a href="index.html" >Home</a></h1> <ul> + {{import pickle}} {{if auth.is_logged_in():}} - <li><a href={{="index?profile="+auth.user.username}}>{{=auth.user.username}}</a>: </li> - <li><a href="user/logout">Log Out</li> - <li><a href="upload.html" >New Image</a></li> + <li><a href={{="profile?profile="+auth.user.username}}>{{=auth.user.username}}</a>: </li> + {{if auth.has_membership("admin"):}} + <li><a href="admin">Admin Acount</a><li> + {{pass}} + {{if num_requests > 0:}} + <li><a href = "requests">{{=str(num_requests)+" Request(s)"}}</a></li> + {{pass}} + <li><a href="user/logout">Log Out</a></li> {{pass}} {{if not auth.is_logged_in():}} <li><a href="user.html">log in</a></li> diff --git a/views/default/admin.html b/views/default/admin.html new file mode 100644 index 0000000..feb1924 --- /dev/null +++ b/views/default/admin.html @@ -0,0 +1,33 @@ +{{extend 'default/_base.html'}} +<br><br> +<center> +<table><tr> +<td>Username</td> +<td>Email</td> +<td>Delete User</td> +<td>Admin Status</td> +{{for user in users:}} + <tr> + <td><a href={{= 'profile?profile=' +str(user.username)}}>{{=user.username}}</a></td> + <td>{{=user.email}}</td> + <td><a href={{="delete_user?user="+user.username+";page="+str(page)}}>Delete</a></td> + {{if auth.has_membership('admin', user.id):}} + <td>Admin (<a href={{="remove_admin?user="+str(user.id)+";page="+str(page)}}>Remove Admin</a>)</td> + {{pass}} + {{if not auth.has_membership('admin',user.id):}} + <td><a href={{='make_admin?user='+str(user.id)+';page='+str(page)}}>Make Admin</a></td> + {{pass}} + </tr> + {{pass}} +</table> +<ul id="navlist"> +{{for count in range(pages):}} + {{if count+1 == page:}} + <li>{{=str(page)}}</li> + {{pass}} + {{if count+1 != page:}} + <li><a href = {{="admin.html?page="+str(count+1)}}>{{ = str(count+1)}}</a></li> + {{pass}} + {{pass}} +</ul> +</center> diff --git a/views/default/delete_image_confirmation.html b/views/default/delete_image_confirmation.html new file mode 100644 index 0000000..1573d2b --- /dev/null +++ b/views/default/delete_image_confirmation.html @@ -0,0 +1,5 @@ +{{extend 'default/_base.html'}} +<h1>Are you sure you want to delete this image?</h1> +<p> +<a href={{="delete_image?id="+str(image.id)}}>yes delete image</a> +<a href={{="image?image="+str(image.id)}}>no don't delete image</a></p> diff --git a/views/default/friends.html b/views/default/friends.html new file mode 100644 index 0000000..4dacbaa --- /dev/null +++ b/views/default/friends.html @@ -0,0 +1,27 @@ +{{extend 'default/_base.html'}} +{{=username+"'s Friends List:"}} +<center> +<table> +{{for user in friends:}} + <tr> + <td>{{=user.username}}</td> + <td><a href={{= 'profile?profile=' +str(user.username)}}>view profile</a></td> + {{if auth.is_logged_in():}} + {{if username == auth.user.username:}} + <td><a href={{= 'remove_friends?user=' +str(user.username)}}>remove friend</a></td> + {{pass}} + {{pass}} + </tr> + {{pass}} +</table> +<ul id="navlist"> +{{for count in range(pages):}} + {{if count+1 == page:}} + <li>{{=str(page)}}</li> + {{pass}} + {{if count+1 != page:}} + <li><a href = {{="admin.html?page="+str(count+1)}}>{{ = str(count+1)}}</a></li> + {{pass}} + {{pass}} +</ul> +</center> diff --git a/views/default/image.html b/views/default/image.html index 7af062f..223ed4d 100644 --- a/views/default/image.html +++ b/views/default/image.html @@ -3,11 +3,25 @@ <img width="1000px"src="{{=URL(r=request, f='download', args=image.newimage)}}"> <br> {{if auth.is_logged_in():}} - {{if image.creator == auth.user.username:}} - <a href={{="delete?id="+str(image.id)}}>delete image</a> + {{if auth.user.username in favorites:}} + <a href={{="remove_as_favorite?id="+str(image.id)}}>remove from favorites</a> + {{pass}} + {{if auth.user.username not in favorites:}} + <a href={{="add_as_favorite?id="+str(image.id)}}>add to favorites</a> + {{pass}} + <br><br> + {{if image.creator == auth.user.username or auth.has_membership('admin'):}} + <a href={{="delete_image_confirmation?id="+str(image.id)}}>delete image</a> {{pass}} + <!--<br><br> + {{if image.creator == auth.user.username:}} + {{pass}} + <a href={{="make_avatar?image="+str(image.id)}}>make this your avatar</a>>--> {{pass}} -<p>{{ = "author: "}}<a href={{= "index?profile=" +str(image.creator)}}>{{=image.creator}} </a></p> +{{if len(favorites) > 0:}} + <p>{{ = "this is in " + str(len(favorites)) + " users favorite pictures"}}</p> + {{pass}} +<p>{{ = "author: "}}<a href={{= "profile?profile=" +str(image.creator)}}>{{=image.creator}} </a></p> <a href="{{=URL(r=request, f='download', args=image.file)}}"> Download TA file</a> <p>{{ = "description: " + str(image.description)}}</p> <p>views: {{=image.views}}</p> @@ -15,6 +29,11 @@ {{for comment in comments:}} <a href={{= "profile?user=" +str(comment.author)}}>{{=comment.author}} </a> {{=": " + comment.body}} + {{if auth.is_logged_in():}} + {{if image.creator == auth.user.username or auth.has_membership('admin'):}} + ( <a href={{="delete_comment?id="+str(comment.id)+";image="+str(image.id)}}>delete comment</a> ) + {{pass}} + {{pass}} <br> <br> {{pass}} diff --git a/views/default/index.html b/views/default/index.html index da1f19c..455f564 100644 --- a/views/default/index.html +++ b/views/default/index.html @@ -1,6 +1,11 @@ {{extend 'default/_base.html'}} {{if profile != None:}} - <h1>{{=profile+ "'s Submissions"}}</h1> + {{if not show_favorites:}} + <h1>{{=profile.username+ "'s Submissions:"}}</h1> + {{pass}} + {{if show_favorites:}} + <h1>{{=profile.username+ "'s Favorites:"}}</h1> + {{pass}} {{pass}} {{if profile == None:}} <h1>Submissions</h1> @@ -19,10 +24,10 @@ {{if profile != None:}} {{if sort == "newest":}} {{=sort}} - <a href={{="index.html?sort=views;profile="+profile}}> views</a></p> + <a href={{="index.html?sort=views;profile="+profile.username+";favorites"+str(show_favorites)}}> views</a></p> {{pass}} {{if sort == "views":}} - <a href={{="index.html?profile="+profile}}> newest</a> + <a href={{="index.html?profile="+profile.username+";favorites"+str(show_favorites)}}> newest</a> {{=sort}}</p> {{pass}} {{pass}} @@ -30,9 +35,14 @@ <table><tr> {{for image in row:}} <td><a href = {{="image.html?image="+str(image.id)}}> - <img width="250px" src="{{=URL(r=request, f='download', args=image.newimage)}}" + <img src="{{=URL(r=request, f='download', args=image.small_image)}}" onclick="ajax('ajaxwiki_onclick',['text'],'html')"/> - <br><center>{{=image.title}}</center></a></td> + {{if len(image.title)>30:}} + <br><center>{{=image.title[:27]+"..."}}</center></a></td> + {{pass}} + {{if len(image.title)<=30:}} + <br><center>{{=image.title}}</center></a></td> + {{pass}} {{pass}} </tr></table> {{pass}} @@ -44,10 +54,10 @@ {{pass}} {{if count+1 != page:}} {{if profile == None:}} - <li><a href = {{="index.html?page="+str(count+1)+";sort="+sort}}>{{ = str(count+1)}}</a></li> + <li><a href = {{="index.html?page="+str(count+1)+";sort="+sort+";favorites"+str(show_favorites)}}>{{ = str(count+1)}}</a></li> {{pass}} {{if profile != None:}} - <li><a href = {{="index.html?page="+str(count+1)+";sort="+sort}}+";profile="+profile>{{ = str(count+1)}}</a></li> + <li><a href = {{="index.html?page="+str(count+1)+";sort="+sort+";profile="+profile.username+";favorites"+str(show_favorites)}}>{{ = str(count+1)}}</a></li> {{pass}} {{pass}} {{pass}} diff --git a/views/default/profile.html b/views/default/profile.html new file mode 100644 index 0000000..ed442c0 --- /dev/null +++ b/views/default/profile.html @@ -0,0 +1,42 @@ +{{extend 'default/_base.html'}} +{{if avatar != None:}} + <img src="{{=URL(r=request,f='download',args=avatar.avatar)}}"/> + {{pass}} +<h1>{{=profile.username + "'s profile"}}</h1> +{{if auth.is_logged_in():}} + {{if profile.username != auth.user.username:}} + {{if ("friend",auth.user.username) in requests:}} + <p>friend request pending</p> + {{pass}} + {{if ("friend",auth.user.username) not in requests and auth.user.username not in friends:}} + <p><a href={{="add_as_friend?user="+profile.username}}>Add as friend</a></p> + {{pass}} + <p>{{=profile.username+" has "+str(len(friends))+" friend(s) ("}}<a href={{="friends?user="+profile.username}}>view all</a>)</p> + {{pass}} + {{if profile.username == auth.user.username:}} + <p>{{="You have "+str(len(friends))+" friend(s) ("}}<a href={{="friends?user="+profile.username}}>view all</a>)</p> + {{pass}} + {{pass}} + +<p>{{=profile.username + "'s submissions ("}}<a href={{="index?profile="+profile.username}}>view all</a>):</p> +{{for row in images:}} + <table><tr> + {{for image in row:}} + <td><a href = {{="image.html?image="+str(image.id)}}> + <img src="{{=URL(r=request, f='download', args=image.small_image)}}" + onclick="ajax('ajaxwiki_onclick',['text'],'html')"/> + <br><center>{{=image.title}}</center></a></td> + {{pass}} + </tr></table> + {{pass}} +<p>{{=profile.username + "'s favorites("}}<a href={{="index?profile="+profile.username+";favorites=True"}}>view all</a>):</p> +{{for row in favorites:}} + <table><tr> + {{for image in row:}} + <td><a href = {{="image.html?image="+str(image.id)}}> + <img width="250px" src="{{=URL(r=request, f='download', args=image.small_image)}}" + onclick="ajax('ajaxwiki_onclick',['text'],'html')"/> + <br><center>{{=image.title}}</center></a></td> + {{pass}} + </tr></table> + {{pass}} diff --git a/views/default/requests.html b/views/default/requests.html new file mode 100644 index 0000000..6bd5c6c --- /dev/null +++ b/views/default/requests.html @@ -0,0 +1,13 @@ +{{extend 'default/_base.html'}} +{{if len(requests)==0:}} + <p>There are no friend requests currently</p> + {{pass}} +<br> +{{for request in requests:}} + {{if request[0] == 'friend':}} + {{=request[1] + " wants to be your friend:"}} + <a href={{="respond_to_request?response=True;user="+request[1]}}>Confirm Friend</a> + <a href={{="respond_to_request?response=False;user="+request[1]}}>Decline Friend</a> + {{pass}} + {{pass}} + |