diff --git a/.reviewboardrc b/.reviewboardrc
new file mode 100644
index 0000000..5749a5d
--- /dev/null
+++ b/.reviewboardrc
@@ -0,0 +1,4 @@
+REVIEWBOARD_URL = "sand10.scholarsportal.info/reviews"
+REPOSITORY = "Swiftbrowser"
+BRANCH = "master"
+LAND_DEST_BRANCH = "master"
diff --git a/swiftbrowser/settings.py b/swiftbrowser/settings.py
index b88fc2a..9585cbd 100644
--- a/swiftbrowser/settings.py
+++ b/swiftbrowser/settings.py
@@ -42,3 +42,7 @@
STATIC_URL = "http://cdnjs.cloudflare.com/ajax/libs/"
ALLOWED_HOSTS = ['127.0.0.1', 'insert_your_hostname_here']
+
+SWIFT_BROWSER_SETTINGS = {
+ "containers_per_page" : 5
+}
\ No newline at end of file
diff --git a/swiftbrowser/templates/containerview.html b/swiftbrowser/templates/containerview.html
index 8b03d4c..7ad021b 100644
--- a/swiftbrowser/templates/containerview.html
+++ b/swiftbrowser/templates/containerview.html
@@ -7,10 +7,10 @@
{% include "messages.html" %}
-
+
+
-
+
|
@@ -20,7 +20,7 @@
-
+
|
@@ -43,7 +43,7 @@
{% trans 'Sharing' %}
{% endif %}
-
+
{% trans 'Delete container' %}
@@ -53,31 +53,50 @@
-
+
{% empty %}
{% trans 'There are no containers in this account yet. Create a new container by clicking the red button.' %}
|
-
-
+
+
{% endfor %}
-
-
+
+
- {{account_stat.x_account_bytes_used|filesizeformat}}
+ {{account_stat.x_account_bytes_used|filesizeformat}}
{% if account_stat.x_account_meta_quota_bytes %}
{% trans 'of' %}
- {{account_stat.x_account_meta_quota_bytes|filesizeformat}}
+ {{account_stat.x_account_meta_quota_bytes|filesizeformat}}
{% endif %}
{% trans 'used' %}
|
+
{% endblock %}
diff --git a/swiftbrowser/views.py b/swiftbrowser/views.py
index 193fe4d..7ab304b 100644
--- a/swiftbrowser/views.py
+++ b/swiftbrowser/views.py
@@ -53,8 +53,46 @@ def containerview(request):
storage_url = request.session.get('storage_url', '')
auth_token = request.session.get('auth_token', '')
+ # "markers" is a list used to keep track of container names for pagination.
+ if "markers" not in request.session:
+
+ # The initial marker with an empty string.
+ request.session["markers"] = ['']
+ marker = ""
+
+ if("get_next" in request.POST):
+
+ # If requesting the next page, and there are none,
+ # the marker should be the last not None marker.
+ if request.session["markers"][-1] is None:
+ request.session["markers"].pop()
+
+ # Use the latest marker to get the next page.
+ marker = request.session["markers"][-1]
+
+ elif ("get_previous" in request.POST):
+
+ # Remove the "next" marker
+ request.session["markers"].pop()
+
+ # Remove the "current" marker if we're not at the very beginning.
+ if len(request.session["markers"]) != 1:
+ request.session["markers"].pop()
+
+ # Use the "previous" marker
+ marker = request.session["markers"][-1]
+
+ else:
+ # Reset marker stack.
+ request.session["markers"] = ['']
+ marker = ""
+
try:
- account_stat, containers = client.get_account(storage_url, auth_token)
+ account_stat, containers = client.get_account(
+ storage_url,
+ auth_token,
+ marker,
+ settings.SWIFT_BROWSER_SETTINGS["containers_per_page"])
except client.ClientException as exc:
if exc.http_status == 403:
account_stat = {}
@@ -68,6 +106,17 @@ def containerview(request):
else:
return redirect(login)
+ # Add the last result to the markers list.
+ if len(containers) == 5:
+ new_marker = containers[-1]["name"]
+ else:
+ new_marker = None
+
+ request.session["markers"].append(new_marker)
+
+ # Save the session
+ request.session.modified = True
+
account_stat = replace_hyphens(account_stat)
return render_to_response('containerview.html', {