Browse Source

Catch "photo not found" in view.php

Tobias Reich 9 years ago
parent
commit
0f8bf0f8e1
2 changed files with 12 additions and 0 deletions
  1. 2 0
      src/scripts/build.js
  2. 10 0
      src/scripts/view/main.js

+ 2 - 0
src/scripts/build.js

@@ -195,6 +195,8 @@ build.no_content = function(typ) {
 									break;
 		case 'cog':					html += '<p>No configuration</p>';
 									break;
+		case 'question-mark':		html += '<p>Photo not found</p>';
+									break;
 	}
 
 	html += '</div>';

+ 10 - 0
src/scripts/view/main.js

@@ -81,6 +81,16 @@ loadPhotoInfo = function(photoID) {
 
 	api.post('Photo::get', params, function(data) {
 
+		if (data==='Warning: Photo private!'||
+			data==='Warning: Wrong password!') {
+
+				$('body').append(build.no_content('question-mark'));
+				$('body').removeClass('view');
+				header.dom().remove();
+				return false;
+
+		}
+
 		/* Set title */
 
 		if (!data.title) data.title = 'Untitled';