Streamlines type of password

This commit is contained in:
Tobias Reich 2015-02-27 21:16:22 +01:00
parent 67dce773e6
commit b226f879b0
10 changed files with 28 additions and 27 deletions

BIN
dist/main.js vendored

Binary file not shown.

BIN
dist/view.js vendored

Binary file not shown.

View File

@ -83,7 +83,7 @@ class Album extends Module {
$albums = $this->database->query($query);
$return = $albums->fetch_assoc();
$return['sysdate'] = date('d M. Y', $return['sysstamp']);
$return['password'] = ($return['password']=='' ? false : true);
$return['password'] = ($return['password']=='' ? '0' : '1');
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE album = '?' " . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS, $this->albumIDs));
break;
@ -180,7 +180,7 @@ class Album extends Module {
# Parse info
$album['sysdate'] = date('F Y', $album['sysstamp']);
$album['password'] = ($album['password'] != '');
$album['password'] = ($album['password']=='' ? '0' : '1');
# Thumbs
if (($public===true&&$album['password']===false)||($public===false)) {

View File

@ -456,10 +456,10 @@ album.setPublic = function(albumID, e) {
if ($('.basicModal .choice input[name="password"]:checked').length===1) {
password = $('.basicModal .choice input[data-name="password"]').val();
album.json.password = 1;
album.json.password = '1';
} else {
password = '';
album.json.password = 0;
album.json.password = '0';
}
if ($('.basicModal .choice input[name="listed"]:checked').length===1) listed = true;
@ -469,8 +469,8 @@ album.setPublic = function(albumID, e) {
if (visible.album()) {
album.json.public = (album.json.public==0) ? 1 : 0;
album.json.password = (album.json.public==0) ? 0 : album.json.password;
album.json.public = (album.json.public==='0') ? '1' : '0';
album.json.password = (album.json.public==='0') ? '0' : album.json.password;
view.album.public();
view.album.password();
@ -526,7 +526,7 @@ album.getArchive = function(albumID) {
if (location.href.indexOf('index.html')>0) link = location.href.replace(location.hash, '').replace('index.html', url);
else link = location.href.replace(location.hash, '') + url;
if (lychee.publicMode) link += '&password=' + password.value;
if (lychee.publicMode===true) link += '&password=' + password.value;
location.href = link;

View File

@ -96,7 +96,7 @@ albums.load = function() {
albums.parse = function(album) {
if (album.password&&lychee.publicMode) {
if (album.password==='1'&&lychee.publicMode===true) {
album.thumb0 = 'src/images/password.svg';
album.thumb1 = 'src/images/password.svg';
album.thumb2 = 'src/images/password.svg';

View File

@ -92,7 +92,7 @@ build.album = function(data) {
if (data.public==='1') html += `<a class='badge icn-share'>${ build.iconic('eye') }</a>`;
if (data.unsorted==='1') html += `<a class='badge'>${ build.iconic('list') }</a>`;
if (data.recent==='1') html += `<a class='badge'>${ build.iconic('clock') }</a>`;
if (data.password===true) html += `<a class='badge'>${ build.iconic('lock-locked') }</a>`;
if (data.password==='1') html += `<a class='badge'>${ build.iconic('lock-locked') }</a>`;
}
@ -244,12 +244,12 @@ build.uploadModal = function(title, files) {
}
build.tags = function(tags, forView) {
build.tags = function(tags, forView = false) {
var html = '',
editTagsHTML = '';
if (forView!==true&&lychee.publicMode!==true) editTagsHTML = ' ' + build.editIcon('edit_tags');
if (forView===false&&lychee.publicMode===false) editTagsHTML = ' ' + build.editIcon('edit_tags');
if (tags!=='') {
@ -271,7 +271,7 @@ build.tags = function(tags, forView) {
}
build.infoboxPhoto = function(data, forView) {
build.infoboxPhoto = function(data, forView = false) {
var html = '',
visible = '',
@ -293,7 +293,7 @@ build.infoboxPhoto = function(data, forView) {
}
if (forView!==true&&lychee.publicMode!==true) {
if (forView===false&&lychee.publicMode===false) {
editTitleHTML = ' ' + build.editIcon('edit_title');
editDescriptionHTML = ' ' + build.editIcon('edit_description');
}
@ -355,7 +355,7 @@ build.infoboxPhoto = function(data, forView) {
case 'Tags':
// Tags
if (forView!==true&&lychee.publicMode===false) {
if (forView===false&&lychee.publicMode===false) {
html += `
</table>
@ -395,7 +395,7 @@ build.infoboxPhoto = function(data, forView) {
}
build.infoboxAlbum = function(data, forView) {
build.infoboxAlbum = function(data, forView = false) {
var html = '',
visible = '',
@ -418,9 +418,9 @@ build.infoboxAlbum = function(data, forView) {
switch (data.password) {
case false: password = 'No';
case '0': password = 'No';
break;
case true: password = 'Yes';
case '1': password = 'Yes';
break;
default: password = '-';
break;
@ -438,7 +438,7 @@ build.infoboxAlbum = function(data, forView) {
}
if (forView!==true&&lychee.publicMode!==true) {
if (forView===false&&lychee.publicMode===false) {
editTitleHTML = ' ' + build.editIcon('edit_title_album');
editDescriptionHTML = ' ' + build.editIcon('edit_description_album');
}

View File

@ -91,7 +91,7 @@ header.setMode = function(mode) {
album.json.content === false ? $('#button_archive').hide() : $('#button_archive').show();
// Hide download button when not logged in and album not downloadable
if (lychee.publicMode&&album.json.downloadable==='0') $('#button_archive').hide();
if (lychee.publicMode===true&&album.json.downloadable==='0') $('#button_archive').hide();
if (albumID==='s'||albumID==='f'||albumID==='r') {
$('#button_info_album, #button_trash_album, #button_share_album').hide();

View File

@ -14,9 +14,9 @@ password.get = function(albumID, callback) {
var passwd = $('.basicModal input.text').val(),
params;
if (!lychee.publicMode) callback();
else if (album.json&&album.json.password==false) callback();
else if (albums.json&&albums.json.albums[albumID].password==false) callback();
if (lychee.publicMode===false) callback();
else if (album.json&&album.json.password==='0') callback();
else if (albums.json&&albums.json.albums[albumID].password==='0') callback();
else if (!albums.json&&!album.json) {
// Continue without password

View File

@ -698,7 +698,7 @@ photo.getArchive = function(photoID) {
if (location.href.indexOf('index.html')>0) link = location.href.replace(location.hash, '').replace('index.html', url);
else link = location.href.replace(location.hash, '') + url;
if (lychee.publicMode) link += '&password=' + password.value;
if (lychee.publicMode===true) link += '&password=' + password.value;
location.href = link;

View File

@ -49,7 +49,7 @@ view.albums = {
albumsData = '';
/* Smart Albums */
if (!lychee.publicMode) {
if (lychee.publicMode===false) {
albums.parse(albums.json.smartalbums.unsorted);
albums.parse(albums.json.smartalbums.public);
@ -70,7 +70,8 @@ view.albums = {
albumsData = build.album(this) + albumsData;
});
if (!lychee.publicMode) albumsData = build.divider('Albums') + albumsData;
// Add divider
if (lychee.publicMode===false) albumsData = build.divider('Albums') + albumsData;
}
@ -275,8 +276,8 @@ view.album = {
password: function() {
if (album.json.password==1) $('#infobox .attr_password').html('Yes');
else $('#infobox .attr_password').html('No');
if (album.json.password==='1') $('#infobox .attr_password').html('Yes');
else $('#infobox .attr_password').html('No');
},