New naming for all API calls

This commit is contained in:
Tobias Reich 2015-02-02 23:36:33 +01:00
parent 7b1f95688c
commit 5678de1000
12 changed files with 75 additions and 77 deletions

BIN
dist/main.js vendored

Binary file not shown.

View File

@ -15,46 +15,46 @@ class Admin extends Access {
switch ($fn) {
# Album functions
case 'getAlbums': $this->getAlbums(); break;
case 'getAlbum': $this->getAlbum(); break;
case 'addAlbum': $this->addAlbum(); break;
case 'setAlbumTitle': $this->setAlbumTitle(); break;
case 'setAlbumDescription': $this->setAlbumDescription(); break;
case 'setAlbumPublic': $this->setAlbumPublic(); break;
case 'deleteAlbum': $this->deleteAlbum(); break;
case 'Album::getAll': $this->getAlbums(); break;
case 'Album::get': $this->getAlbum(); break;
case 'Album::add': $this->addAlbum(); break;
case 'Album::setTitle': $this->setAlbumTitle(); break;
case 'Album::setDescription': $this->setAlbumDescription(); break;
case 'Album::setPublic': $this->setAlbumPublic(); break;
case 'Album::delete': $this->deleteAlbum(); break;
# Photo functions
case 'getPhoto': $this->getPhoto(); break;
case 'setPhotoTitle': $this->setPhotoTitle(); break;
case 'setPhotoDescription': $this->setPhotoDescription(); break;
case 'setPhotoStar': $this->setPhotoStar(); break;
case 'setPhotoPublic': $this->setPhotoPublic(); break;
case 'setPhotoAlbum': $this->setPhotoAlbum(); break;
case 'setPhotoTags': $this->setPhotoTags(); break;
case 'duplicatePhoto': $this->duplicatePhoto(); break;
case 'deletePhoto': $this->deletePhoto(); break;
case 'Photo::get': $this->getPhoto(); break;
case 'Photo::setTitle': $this->setPhotoTitle(); break;
case 'Photo::setDescription': $this->setPhotoDescription(); break;
case 'Photo::setStar': $this->setPhotoStar(); break;
case 'Photo::setPublic': $this->setPhotoPublic(); break;
case 'Photo::setAlbum': $this->setPhotoAlbum(); break;
case 'Photo::setTags': $this->setPhotoTags(); break;
case 'Photo::duplicate': $this->duplicatePhoto(); break;
case 'Photo::delete': $this->deletePhoto(); break;
# Add functions
case 'upload': $this->upload(); break;
case 'importUrl': $this->importUrl(); break;
case 'importServer': $this->importServer(); break;
case 'Photo::add': $this->upload(); break;
case 'Import::url': $this->importUrl(); break;
case 'Import::server': $this->importServer(); break;
# Search functions
case 'search': $this->search(); break;
# Session functions
case 'init': $this->init(); break;
case 'login': $this->login(); break;
case 'logout': $this->logout(); break;
case 'Session::init': $this->init(); break;
case 'Session::login': $this->login(); break;
case 'Session::logout': $this->logout(); break;
# Settings functions
case 'setLogin': $this->setLogin(); break;
case 'setSorting': $this->setSorting(); break;
case 'setDropboxKey': $this->setDropboxKey(); break;
case 'Settings::setLogin': $this->setLogin(); break;
case 'Settings::setSorting': $this->setSorting(); break;
case 'Settings::setDropboxKey': $this->setDropboxKey(); break;
# $_GET functions
case 'getAlbumArchive': $this->getAlbumArchive(); break;
case 'getPhotoArchive': $this->getPhotoArchive(); break;
case 'Album::getArchive': $this->getAlbumArchive(); break;
case 'Photo::getArchive': $this->getPhotoArchive(); break;
# Error
default: exit('Error: Function not found! Please check the spelling of the called function.');

View File

@ -15,21 +15,21 @@ class Guest extends Access {
switch ($fn) {
# Album functions
case 'getAlbums': $this->getAlbums(); break;
case 'getAlbum': $this->getAlbum(); break;
case 'checkAlbumAccess': $this->checkAlbumAccess(); break;
case 'Album::getAll': $this->getAlbums(); break;
case 'Album::get': $this->getAlbum(); break;
case 'Album::getPublic': $this->checkAlbumAccess(); break;
# Photo functions
case 'getPhoto': $this->getPhoto(); break;
case 'Photo::get': $this->getPhoto(); break;
# Session functions
case 'init': $this->init(); break;
case 'login': $this->login(); break;
case 'logout': $this->logout(); break;
case 'Session::init': $this->init(); break;
case 'Session::login': $this->login(); break;
case 'Session::logout': $this->logout(); break;
# $_GET functions
case 'getAlbumArchive': $this->getAlbumArchive(); break;
case 'getPhotoArchive': $this->getPhotoArchive(); break;
case 'Album::getArchive': $this->getAlbumArchive(); break;
case 'Photo::getArchive': $this->getPhotoArchive(); break;
# Error
default: exit('Error: Function not found! Please check the spelling of the called function.');

View File

@ -14,7 +14,7 @@ class Installation extends Access {
switch ($fn) {
case 'dbCreateConfig': $this->dbCreateConfig(); break;
case 'Database::createConfig': $this->dbCreateConfig(); break;
# Error
default: exit('Warning: No configuration!');

View File

@ -47,7 +47,7 @@ album.load = function(albumID, refresh) {
password: password.value
}
api.post('getAlbum', params, function(data) {
api.post('Album::get', params, function(data) {
if (data==='Warning: Album private!') {
if (document.location.hash.replace('#', '').split('/')[1]!=undefined) {
@ -120,7 +120,7 @@ album.add = function() {
if (title.length===0) title = 'Untitled';
api.post('addAlbum', { title }, function(data) {
api.post('Album::add', { title }, function(data) {
// Avoid first album to be true
if (data===true) data = 1;
@ -172,7 +172,7 @@ album.delete = function(albumIDs) {
albumIDs: albumIDs.join()
}
api.post('deleteAlbum', params, function(data) {
api.post('Album::delete', params, function(data) {
if (visible.albums()) {
@ -297,7 +297,7 @@ album.setTitle = function(albumIDs) {
title: newTitle
}
api.post('setAlbumTitle', params, function(data) {
api.post('Album::setTitle', params, function(data) {
if (data!==true) lychee.error(null, params, data);
@ -351,7 +351,7 @@ album.setDescription = function(albumID) {
description
}
api.post('setAlbumDescription', params, function(data) {
api.post('Album::setDescription', params, function(data) {
if (data!==true) lychee.error(null, params, data);
@ -486,7 +486,7 @@ album.setPublic = function(albumID, e) {
downloadable
}
api.post('setAlbumPublic', params, function(data) {
api.post('Album::setPublic', params, function(data) {
if (data!==true) lychee.error(null, params, data);
@ -521,7 +521,7 @@ album.share = function(service) {
album.getArchive = function(albumID) {
var link,
url = api.path + '?function=getAlbumArchive&albumID=' + albumID;
url = api.path + '?function=Album::getArchive&albumID=' + 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;

View File

@ -22,7 +22,7 @@ albums.load = function() {
if (albums.json===null) {
api.post('getAlbums', {}, function(data) {
api.post('Album::getAll', {}, function(data) {
/* Smart Albums */
data.unsortedAlbum = {

View File

@ -75,7 +75,7 @@ contextMenu.albumTitle = function(albumID, e) {
{ type: 'item', title: build.iconic('pencil') + 'Rename', fn: function() { album.setTitle([albumID]) } }
];
api.post('getAlbums', {}, function(data) {
api.post('Album::getAll', {}, function(data) {
if (data.num!==0) {
@ -176,7 +176,7 @@ contextMenu.move = function(photoIDs, e) {
}
api.post('getAlbums', {}, function(data) {
api.post('Album::getAll', {}, function(data) {
if (data.num===0) {

View File

@ -40,7 +40,7 @@ lychee.init = function() {
version: lychee.version_code
}
api.post('init', params, function(data) {
api.post('Session::init', params, function(data) {
if (data.loggedIn!==true) {
lychee.setMode('public');
@ -84,7 +84,7 @@ lychee.login = function(data) {
password
}
api.post('login', params, function(data) {
api.post('Session::login', params, function(data) {
if (data===true) {
@ -146,7 +146,7 @@ lychee.loginDialog = function() {
lychee.logout = function() {
api.post('logout', {}, function() {
api.post('Session::logout', {}, function() {
window.location.reload();
});

View File

@ -37,7 +37,7 @@ password.get = function(albumID, callback) {
password: md5(passwd)
}
api.post('checkAlbumAccess', params, function(data) {
api.post('Album::getPublic', params, function(data) {
if (data===true) {
basicModal.close();

View File

@ -33,7 +33,7 @@ photo.load = function(photoID, albumID) {
password: password.value
}
api.post('getPhoto', params, function(data) {
api.post('Photo::get', params, function(data) {
if (data==='Warning: Wrong password!') {
checkPasswd = function() {
@ -165,7 +165,7 @@ photo.duplicate = function(photoIDs) {
photoIDs: photoIDs.join()
}
api.post('duplicatePhoto', params, function(data) {
api.post('Photo::duplicate', params, function(data) {
if (data!==true) lychee.error(null, params, data);
else album.load(album.getID());
@ -232,7 +232,7 @@ photo.delete = function(photoIDs) {
photoIDs: photoIDs.join()
}
api.post('deletePhoto', params, function(data) {
api.post('Photo::delete', params, function(data) {
if (data!==true) lychee.error(null, params, data);
@ -315,7 +315,7 @@ photo.setTitle = function(photoIDs) {
title: newTitle
}
api.post('setPhotoTitle', params, function(data) {
api.post('Photo::setTitle', params, function(data) {
if (data!==true) lychee.error(null, params, data);
@ -379,7 +379,7 @@ photo.setAlbum = function(photoIDs, albumID) {
albumID
}
api.post('setPhotoAlbum', params, function(data) {
api.post('Photo::setAlbum', params, function(data) {
if (data!==true) lychee.error(null, params, data);
@ -408,7 +408,7 @@ photo.setStar = function(photoIDs) {
photoIDs: photoIDs.join()
}
api.post('setPhotoStar', params, function(data) {
api.post('Photo::setStar', params, function(data) {
if (data!==true) lychee.error(null, params, data);
@ -460,7 +460,7 @@ photo.setPublic = function(photoID, e) {
albums.refresh();
api.post('setPhotoPublic', { photoID }, function(data) {
api.post('Photo::setPublic', { photoID }, function(data) {
if (data!==true) lychee.error(null, params, data);
@ -493,7 +493,7 @@ photo.setDescription = function(photoID) {
description
}
api.post('setPhotoDescription', params, function(data) {
api.post('Photo::setDescription', params, function(data) {
if (data!==true) lychee.error(null, params, data);
@ -597,7 +597,7 @@ photo.setTags = function(photoIDs, tags) {
tags
}
api.post('setPhotoTags', params, function(data) {
api.post('Photo::setTags', params, function(data) {
if (data!==true) lychee.error(null, params, data);
@ -693,7 +693,7 @@ photo.getSize = function() {
photo.getArchive = function(photoID) {
var link,
url = api.path + '?function=getPhotoArchive&photoID=' + photoID;
url = api.path + '?function=Photo::getArchive&photoID=' + 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;

View File

@ -35,7 +35,7 @@ settings.createConfig = function() {
dbTablePrefix
}
api.post('dbCreateConfig', params, function(data) {
api.post('Database::createConfig', params, function(data) {
if (data!==true) {
@ -163,14 +163,12 @@ settings.createLogin = function() {
basicModal.close();
params = 'setLogin&username=' + escape(username) + '&password=' + md5(password);
params = {
username,
password: md5(password)
}
api.post('setLogin', params, function(data) {
api.post('Settings::setLogin', params, function(data) {
if (data!==true) {
@ -245,7 +243,7 @@ settings.setLogin = function() {
password: md5(password)
}
api.post('setLogin', params, function(data) {
api.post('Settings::setLogin', params, function(data) {
if (data!==true) lychee.error(null, params, data);
@ -302,7 +300,7 @@ settings.setSorting = function() {
order: sorting[1]
}
api.post('setSorting', params, function(data) {
api.post('Settings::setSorting', params, function(data) {
if (data===true) {
lychee.sorting = 'ORDER BY ' + sorting[0] + ' ' + sorting[1];
@ -375,7 +373,7 @@ settings.setDropboxKey = function(callback) {
basicModal.close();
api.post('setDropboxKey', { key }, function(data) {
api.post('Settings::setDropboxKey', { key }, function(data) {
if (data===true) {
lychee.dropboxKey = key;

View File

@ -106,7 +106,7 @@ upload.start = {
}
formData.append('function', 'upload');
formData.append('function', 'Photo::add');
formData.append('albumID', albumID);
formData.append('tags', '');
formData.append(0, file);
@ -272,7 +272,7 @@ upload.start = {
albumID
}
api.post('importUrl', params, function(data) {
api.post('Import::url', params, function(data) {
basicModal.close();
upload.notify('Import complete');
@ -335,7 +335,7 @@ upload.start = {
path: data.path
}
api.post('importServer', params, function(data) {
api.post('Import::server', params, function(data) {
basicModal.close();
upload.notify('Import complete');
@ -410,7 +410,7 @@ upload.start = {
albumID
}
api.post('importUrl', params, function(data) {
api.post('Import::url', params, function(data) {
basicModal.close();
upload.notify('Import complete');