Syntax adjustments
This commit is contained in:
parent
1020b0d1dc
commit
0c7d95fb15
@ -9,13 +9,18 @@ use Lychee\Modules\Response;
|
||||
|
||||
// Add parent field to albums
|
||||
$query = Database::prepare($connection, "SELECT `parent` FROM `?` LIMIT 1", array(LYCHEE_TABLE_ALBUMS));
|
||||
if (!Database::execute($connection, $query, "update_030103", __LINE__)) {
|
||||
$result = Database::execute($connection, $query, "update_030103", __LINE__);
|
||||
|
||||
if ($result===false) {
|
||||
|
||||
$query = Database::prepare($connection, "ALTER TABLE `?` ADD `parent` BIGINT(14) NOT NULL DEFAULT 0", array(LYCHEE_TABLE_ALBUMS));
|
||||
$result = Database::execute($connection, $query, "update_030103", __LINE__);
|
||||
if (!$result) {
|
||||
|
||||
if ($result===false) {
|
||||
Log::error($database, 'update_030103', __LINE__, 'Could not update database (' . $database->error . ')');
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Set version
|
||||
|
@ -12,7 +12,7 @@ album = {
|
||||
|
||||
album.isSmartID = function(id) {
|
||||
|
||||
return id==='0' || id==='f' || id==='s' || id==='r'
|
||||
return (id==='0' || id==='f' || id==='s' || id==='r')
|
||||
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ album.getID = function() {
|
||||
let id = null
|
||||
|
||||
let isID = (id) => {
|
||||
if (album.isSmartID(id)) return true
|
||||
if (album.isSmartID(id)===true) return true
|
||||
return $.isNumeric(id)
|
||||
}
|
||||
|
||||
@ -35,19 +35,18 @@ album.getID = function() {
|
||||
}
|
||||
|
||||
if (isID(id)===true) return id
|
||||
else return false
|
||||
|
||||
return false
|
||||
|
||||
}
|
||||
|
||||
album.getParent = function() {
|
||||
|
||||
let id = album.json.id;
|
||||
let id = album.json.id
|
||||
|
||||
if (album.isSmartID(id)===true || album.json.parent==0) return ''
|
||||
|
||||
if (album.isSmartID(id) || album.json.parent==0) {
|
||||
return ''
|
||||
} else {
|
||||
return album.json.parent
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -109,7 +108,8 @@ album.load = function(albumID, refresh = false) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!album.isSmartID(albumID)) {
|
||||
if (album.isSmartID(albumID)===false) {
|
||||
|
||||
params = {
|
||||
parent: albumID
|
||||
}
|
||||
@ -125,14 +125,14 @@ album.load = function(albumID, refresh = false) {
|
||||
if (durationTime>300) waitTime = 0
|
||||
else waitTime = 300 - durationTime
|
||||
|
||||
setTimeout(() => {
|
||||
finish()
|
||||
}, waitTime)
|
||||
setTimeout(finish, waitTime)
|
||||
|
||||
})
|
||||
}
|
||||
else {
|
||||
|
||||
} else {
|
||||
|
||||
finish()
|
||||
|
||||
}
|
||||
|
||||
}, waitTime)
|
||||
@ -192,17 +192,22 @@ album.add = function(albumID = 0) {
|
||||
|
||||
}
|
||||
|
||||
api.post('Albums::get', {
|
||||
parent: -1
|
||||
}, function (data) {
|
||||
var cmbxOptions = `<select name='parent'>`
|
||||
cmbxOptions += `<option value='0'>- None -</option>`
|
||||
cmbxOptions += buildAlbumOptions(data.albums, albumID)
|
||||
cmbxOptions += '</select>'
|
||||
api.post('Albums::get', { parent: -1 }, function(data) {
|
||||
|
||||
let cmbxOptions = `
|
||||
<select name='parent'>
|
||||
<option value='0'>- None -</option>
|
||||
${ buildAlbumOptions(data.albums, albumID) }
|
||||
</select>
|
||||
`
|
||||
|
||||
let msg = `
|
||||
<p>Enter a title for the new album: <input class='text' name='title' type='text' maxlength='50' placeholder='Title' value='Untitled'></p>
|
||||
<p>Select the parent album:<br/> ${ cmbxOptions }</p>
|
||||
`
|
||||
|
||||
basicModal.show({
|
||||
body: `<p>Enter a title for the new album: <input class='text' name='title' type='text' maxlength='50' placeholder='Title' value='Untitled'></p>`
|
||||
+ `<p>Select the parent album:<br/>` + cmbxOptions + `</p>`,
|
||||
body: msg,
|
||||
buttons: {
|
||||
action: {
|
||||
title: 'Create Album',
|
||||
@ -214,6 +219,7 @@ album.add = function(albumID = 0) {
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ albums.load = function() {
|
||||
|
||||
if (albums.json===null) {
|
||||
|
||||
params = {
|
||||
let params = {
|
||||
parent: 0
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ contextMenu.photoMulti = function(photoIDs, e) {
|
||||
if (subcount && photocount) {
|
||||
$('.photo.active, .album.active').removeClass('active')
|
||||
multiselect.close()
|
||||
lychee.error("Please select either albums or photos!")
|
||||
lychee.error('Please select either albums or photos!')
|
||||
return
|
||||
}
|
||||
if (subcount) {
|
||||
|
@ -199,7 +199,7 @@ multiselect.getSelection = function(e) {
|
||||
|
||||
let id = $(this).data('id')
|
||||
|
||||
if (id!=null && id!==0 && !album.isSmartID(id)) {
|
||||
if (id!=null && id!==0 && album.isSmartID(id)===false) {
|
||||
|
||||
ids.push(id)
|
||||
$(this).addClass('active')
|
||||
|
@ -73,7 +73,7 @@ settings.createConfig = function() {
|
||||
if (data==='Warning: Could not create file!') {
|
||||
|
||||
basicModal.show({
|
||||
body: "<p>Unable to save this configuration. Permission denied in <b>'data/'</b>. Please set the read, write and execute rights for others in <b>'data/'</b> and <b>'uploads/'</b>. Take a look at the readme for more information.</p>",
|
||||
body: `<p>Unable to save this configuration. Permission denied in <b>'data/'</b>. Please set the read, write and execute rights for others in <b>'data/'</b> and <b>'uploads/'</b>. Take a look at the readme for more information.</p>`,
|
||||
buttons: {
|
||||
action: {
|
||||
title: 'Retry',
|
||||
|
@ -125,13 +125,17 @@ sidebar.createStructure.photo = function(data) {
|
||||
// Set value for public
|
||||
switch (data.public) {
|
||||
|
||||
case '0' : _public = 'No'
|
||||
case '0':
|
||||
_public = 'No'
|
||||
break
|
||||
case '1' : _public = 'Yes'
|
||||
case '1':
|
||||
_public = 'Yes'
|
||||
break
|
||||
case '2' : _public = 'Yes (Album)'
|
||||
case '2':
|
||||
_public = 'Yes (Album)'
|
||||
break
|
||||
default : _public = '-'
|
||||
default:
|
||||
_public = '-'
|
||||
break
|
||||
|
||||
}
|
||||
|
@ -178,18 +178,25 @@ view.album = {
|
||||
|
||||
title: function(photoID) {
|
||||
|
||||
let ntitle = ''
|
||||
let prefix = ''
|
||||
|
||||
if (album.json.content[photoID]) {
|
||||
ntitle = album.json.content[photoID].title
|
||||
|
||||
prefix = '.photo'
|
||||
}
|
||||
else {
|
||||
ntitle = album.json.content[photoID].title
|
||||
|
||||
} else {
|
||||
|
||||
prefix = '.album'
|
||||
|
||||
for (i in album.subjson.albums) {
|
||||
if (album.subjson.albums[i].id==photoID) {
|
||||
ntitle = album.subjson.albums[i].title
|
||||
break
|
||||
}
|
||||
}
|
||||
prefix = '.album'
|
||||
|
||||
}
|
||||
|
||||
ntitle = lychee.escapeHTML(ntitle)
|
||||
|
Loading…
Reference in New Issue
Block a user