Removed "Set Password" menu after sharing without password

This commit is contained in:
Tobias Reich 2014-07-21 22:38:56 +02:00
parent cf9ad486f0
commit fde153d004
5 changed files with 10 additions and 68 deletions

View File

@ -311,7 +311,6 @@ contextMenu = {
contextMenu.fns = [ contextMenu.fns = [
function() { album.setPublic(albumID) }, function() { album.setPublic(albumID) },
function() { password.set(albumID) },
function() { album.share(0) }, function() { album.share(0) },
function() { album.share(1) }, function() { album.share(1) },
function() { album.share(2) }, function() { album.share(2) },
@ -322,15 +321,12 @@ contextMenu = {
["<input readonly id='link' value='" + location.href + "'>", -1], ["<input readonly id='link' value='" + location.href + "'>", -1],
["separator", -1], ["separator", -1],
["<a class='icon-eye-close'></a> Make Private", 0], ["<a class='icon-eye-close'></a> Make Private", 0],
["<a class='icon-lock'></a> Set Password", 1],
["separator", -1], ["separator", -1],
["<a class='icon-twitter'></a> Twitter", 2], ["<a class='icon-twitter'></a> Twitter", 1],
["<a class='icon-facebook'></a> Facebook", 3], ["<a class='icon-facebook'></a> Facebook", 2],
["<a class='icon-envelope'></a> Mail", 4], ["<a class='icon-envelope'></a> Mail", 3],
]; ];
if (album.json.password==true) items[3] = ["<a class='icon-unlock'></a> Remove Password", 5];
contextMenu.show(items, mouse_x, mouse_y, "left"); contextMenu.show(items, mouse_x, mouse_y, "left");
$(".contextmenu input").focus().select(); $(".contextmenu input").focus().select();

View File

@ -9,33 +9,6 @@ password = {
value: "", value: "",
set: function(albumID) {
var buttons,
params;
buttons = [
["Set Password", function() {
if (visible.album()) {
album.json.password = true;
view.album.password();
}
params = "setAlbumPassword&albumID=" + albumID + "&password=" + md5($(".message input.text").val());
lychee.api(params, function(data) {
if (data!==true) lychee.error(null, params, data);
});
}],
["Cancel", function() {}]
];
modal.show("Set Password", "Set a password to protect '" + album.json.title + "' from unauthorized viewers. Only people with this password can view this album. <input class='text' type='password' placeholder='password' value=''>", buttons);
},
get: function(albumID, callback) { get: function(albumID, callback) {
var passwd = $(".message input.text").val(), var passwd = $(".message input.text").val(),
@ -85,24 +58,6 @@ password = {
]; ];
modal.show("<a class='icon-lock'></a> Enter Password", "This album is protected by a password. Enter the password below to view the photos of this album: <input class='text' type='password' placeholder='password' value=''>", buttons, -110, false); modal.show("<a class='icon-lock'></a> Enter Password", "This album is protected by a password. Enter the password below to view the photos of this album: <input class='text' type='password' placeholder='password' value=''>", buttons, -110, false);
},
remove: function(albumID) {
var params;
if (visible.album()) {
album.json.password = false;
view.album.password();
}
params = "setAlbumPassword&albumID=" + albumID + "&password=";
lychee.api(params, function(data) {
if (data!==true) lychee.error(null, params, data);
});
} }
}; };

File diff suppressed because one or more lines are too long

View File

@ -22,7 +22,6 @@ class Admin extends Access {
case 'setAlbumTitle': $this->setAlbumTitle(); break; case 'setAlbumTitle': $this->setAlbumTitle(); break;
case 'setAlbumDescription': $this->setAlbumDescription(); break; case 'setAlbumDescription': $this->setAlbumDescription(); break;
case 'setAlbumPublic': $this->setAlbumPublic(); break; case 'setAlbumPublic': $this->setAlbumPublic(); break;
case 'setAlbumPassword': $this->setAlbumPassword(); break;
case 'deleteAlbum': $this->deleteAlbum(); break; case 'deleteAlbum': $this->deleteAlbum(); break;
# Photo functions # Photo functions
@ -116,14 +115,6 @@ class Admin extends Access {
} }
private function setAlbumPassword() {
Module::dependencies(isset($_POST['albumID'], $_POST['password']));
$album = new Album($this->database, $this->plugins, $this->settings, $_POST['albumID']);
echo $album->setPassword($_POST['password']);
}
private function deleteAlbum() { private function deleteAlbum() {
Module::dependencies(isset($_POST['albumIDs'])); Module::dependencies(isset($_POST['albumIDs']));

View File

@ -488,7 +488,7 @@ class Album extends Module {
} }
public function setPassword($password) { private function setPassword($password) {
# Check dependencies # Check dependencies
self::dependencies(isset($this->database, $this->albumIDs)); self::dependencies(isset($this->database, $this->albumIDs));