@ -56,26 +56,26 @@ photo = {
} ,
delete : function ( id s) {
delete : function ( photoID s) {
var params ,
buttons ,
photoTitle ;
if ( ! id s) return false ;
if ( ids instanceof Array === false ) ids = [ id s] ;
if ( ! photoID s) return false ;
if ( photoIDs instanceof Array === false ) photoIDs = [ photoID s] ;
if ( id s. length === 1 ) {
if ( photoID s. length === 1 ) {
// Get title if only one photo is selected
if ( visible . photo ( ) ) photoTitle = photo . json . title ;
else photoTitle = album . json . content [ id s] . title ;
else photoTitle = album . json . content [ photoID s] . title ;
if ( photoTitle == "" ) photoTitle = "Untitled" ;
}
buttons = [
[ "Delete" , function ( ) {
id s. forEach ( function ( id , index , array ) {
photoID s. forEach ( function ( id , index , array ) {
// Change reference for the next and previous photo
if ( album . json . content [ id ] . nextPhoto !== "" || album . json . content [ id ] . previousPhoto !== "" ) {
@ -96,7 +96,7 @@ photo = {
// Only when search is not active
if ( ! visible . albums ( ) ) lychee . goto ( album . getID ( ) ) ;
params = "deletePhoto& ids=" + id s;
params = "deletePhoto& photoIDs=" + photoID s;
lychee . api ( params , function ( data ) {
if ( data !== true ) lychee . error ( null , params , data ) ;
@ -107,25 +107,25 @@ photo = {
[ "Cancel" , function ( ) { } ]
] ;
if ( id s. length === 1 ) modal . show ( "Delete Photo" , "Are you sure you want to delete the photo '" + photoTitle + "'?<br>This action can't be undone!" , buttons ) ;
else modal . show ( "Delete Photos" , "Are you sure you want to delete all " + id s. length + " selected photo?<br>This action can't be undone!" , buttons ) ;
if ( photoID s. length === 1 ) modal . show ( "Delete Photo" , "Are you sure you want to delete the photo '" + photoTitle + "'?<br>This action can't be undone!" , buttons ) ;
else modal . show ( "Delete Photos" , "Are you sure you want to delete all " + photoID s. length + " selected photo?<br>This action can't be undone!" , buttons ) ;
} ,
setTitle : function ( id s) {
setTitle : function ( photoID s) {
var oldTitle = "" ,
newTitle ,
params ,
buttons ;
if ( ! id s) return false ;
if ( ids instanceof Array === false ) ids = [ id s] ;
if ( ! photoID s) return false ;
if ( photoIDs instanceof Array === false ) photoIDs = [ photoID s] ;
if ( id s. length === 1 ) {
if ( photoID s. length === 1 ) {
// Get old title if only one photo is selected
if ( photo . json ) oldTitle = photo . json . title ;
else if ( album . json ) oldTitle = album . json . content [ id s] . title ;
else if ( album . json ) oldTitle = album . json . content [ photoID s] . title ;
}
buttons = [
@ -140,12 +140,12 @@ photo = {
view . photo . title ( oldTitle ) ;
}
id s. forEach ( function ( id , index , array ) {
photoID s. forEach ( function ( id , index , array ) {
album . json . content [ id ] . title = newTitle ;
view . album . content . title ( id ) ;
} ) ;
params = "setPhotoTitle& ids=" + id s + "&title=" + escape ( encodeURI ( newTitle ) ) ;
params = "setPhotoTitle& photoIDs=" + photoID s + "&title=" + escape ( encodeURI ( newTitle ) ) ;
lychee . api ( params , function ( data ) {
if ( data !== true ) lychee . error ( null , params , data ) ;
@ -158,22 +158,22 @@ photo = {
[ "Cancel" , function ( ) { } ]
] ;
if ( id s. length === 1 ) modal . show ( "Set Title" , "Please enter a new title for this photo: <input class='text' type='text' placeholder='Title' value='" + oldTitle + "'>" , buttons ) ;
if ( photoID s. length === 1 ) modal . show ( "Set Title" , "Please enter a new title for this photo: <input class='text' type='text' placeholder='Title' value='" + oldTitle + "'>" , buttons ) ;
else modal . show ( "Set Titles" , "Please enter a title for all selected photos: <input class='text' type='text' placeholder='Title' value=''>" , buttons ) ;
} ,
setAlbum : function ( id s, albumID ) {
setAlbum : function ( photoID s, albumID ) {
var params ,
nextPhoto ,
previousPhoto ;
if ( ! id s) return false ;
if ( ! photoID s) return false ;
if ( visible . photo ) lychee . goto ( album . getID ( ) ) ;
if ( ids instanceof Array === false ) ids = [ id s] ;
if ( photoIDs instanceof Array === false ) photoIDs = [ photoID s] ;
id s. forEach ( function ( id , index , array ) {
photoID s. forEach ( function ( id , index , array ) {
// Change reference for the next and previous photo
if ( album . json . content [ id ] . nextPhoto !== "" || album . json . content [ id ] . previousPhoto !== "" ) {
@ -191,7 +191,7 @@ photo = {
} ) ;
params = "setAlbum& ids=" + id s + "&albumID=" + albumID ;
params = "setAlbum& photoIDs=" + photoID s + "&albumID=" + albumID ;
lychee . api ( params , function ( data ) {
if ( data !== true ) lychee . error ( null , params , data ) ;
@ -200,22 +200,22 @@ photo = {
} ,
setStar : function ( id s) {
setStar : function ( photoID s) {
var params ;
if ( ! id s) return false ;
if ( ! photoID s) return false ;
if ( visible . photo ( ) ) {
photo . json . star = ( photo . json . star == 0 ) ? 1 : 0 ;
view . photo . star ( ) ;
}
id s. forEach ( function ( id , index , array ) {
photoID s. forEach ( function ( id , index , array ) {
album . json . content [ id ] . star = ( album . json . content [ id ] . star == 0 ) ? 1 : 0 ;
view . album . content . star ( id ) ;
} ) ;
params = "setPhotoStar& ids=" + id s;
params = "setPhotoStar& photoIDs=" + photoID s;
lychee . api ( params , function ( data ) {
if ( data !== true ) lychee . error ( null , params , data ) ;