mirror of
https://github.com/YACReader/yacreader
synced 2025-06-03 00:58:32 -04:00
antes de a?adir la clase Comic de YACReader a YACReaderLibrary
navegaci?n web con paginaci?n rudimentaria implementada
This commit is contained in:
parent
2afe3101b1
commit
cbee662df4
@ -4,6 +4,23 @@
|
||||
#include <QSqlRecord>
|
||||
#include <QVariant>
|
||||
|
||||
Folder::Folder(qulonglong id, QSqlDatabase & db)
|
||||
{
|
||||
QSqlQuery query(db);
|
||||
query.prepare("SELECT * FROM folder WHERE id = :id");
|
||||
query.bindValue(":id",id);
|
||||
query.exec();
|
||||
this->id = id;
|
||||
this->parentId = 0;
|
||||
if(query.next())
|
||||
{
|
||||
QSqlRecord record = query.record();
|
||||
this->parentId = record.value("parentId").toULongLong();
|
||||
this->name = record.value("name").toString();
|
||||
this->path = record.value("path").toString();
|
||||
}
|
||||
}
|
||||
|
||||
qulonglong Folder::insert(QSqlDatabase & db)
|
||||
{
|
||||
QSqlQuery query(db);
|
||||
|
@ -15,6 +15,7 @@ public:
|
||||
Folder():knownParent(false), knownId(false){};
|
||||
Folder(qulonglong sid, qulonglong pid,QString fn, QString fp):knownParent(true), knownId(true){id = sid; parentId = pid;name = fn; path = fp;};
|
||||
Folder(QString fn, QString fp):knownParent(false), knownId(false){name = fn; path = fp;};
|
||||
Folder(qulonglong id, QSqlDatabase & db);//loads a folder from db;
|
||||
void setId(qulonglong sid){id = sid;knownId = true;};
|
||||
void setFather(qulonglong pid){parentId = pid;knownParent = true;};
|
||||
static QList<LibraryItem *> getFoldersFromParent(qulonglong parentId, QSqlDatabase & db);
|
||||
|
@ -1331,4 +1331,38 @@ void LibraryWindow::showImportComicsInfo()
|
||||
{
|
||||
importComicsInfoDialog->dest = currentPath() + "/.yacreaderlibrary/library.ydb";
|
||||
importComicsInfoDialog->show();
|
||||
}
|
||||
|
||||
QList<LibraryItem *> LibraryWindow::getFolderContentFromLibrary(const QString & libraryName, qulonglong folderId)
|
||||
{
|
||||
QSqlDatabase db = DataBaseManagement::loadDatabase(libraries.value(libraryName)+"/.yacreaderlibrary");
|
||||
|
||||
QList<LibraryItem *> list = Folder::getFoldersFromParent(folderId,db);
|
||||
|
||||
db.close();
|
||||
QSqlDatabase::removeDatabase(libraries.value(libraryName));
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
QList<LibraryItem *> LibraryWindow::getFolderComicsFromLibrary(const QString & libraryName, qulonglong folderId)
|
||||
{
|
||||
QSqlDatabase db = DataBaseManagement::loadDatabase(libraries.value(libraryName)+"/.yacreaderlibrary");
|
||||
|
||||
QList<LibraryItem *> list = Comic::getComicsFromParent(folderId,db);
|
||||
|
||||
db.close();
|
||||
QSqlDatabase::removeDatabase(libraries.value(libraryName));
|
||||
return list;
|
||||
}
|
||||
|
||||
qulonglong LibraryWindow::getParentFromComicFolderId(const QString & libraryName, qulonglong id)
|
||||
{
|
||||
QSqlDatabase db = DataBaseManagement::loadDatabase(libraries.value(libraryName)+"/.yacreaderlibrary");
|
||||
|
||||
Folder f(id,db);
|
||||
|
||||
db.close();
|
||||
QSqlDatabase::removeDatabase(libraries.value(libraryName));
|
||||
return f.parentId;
|
||||
}
|
@ -199,6 +199,12 @@ public:
|
||||
void showExportComicsInfo();
|
||||
void showImportComicsInfo();
|
||||
void asignNumbers();
|
||||
|
||||
//server interface
|
||||
QMap<QString,QString> getLibraries(){return libraries;};
|
||||
QList<LibraryItem *> getFolderContentFromLibrary(const QString & libraryName, qulonglong folderId);
|
||||
QList<LibraryItem *> getFolderComicsFromLibrary(const QString & libraryName, qulonglong folderId);
|
||||
qulonglong getParentFromComicFolderId(const QString & libraryName, qulonglong id);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,9 +1,12 @@
|
||||
#include "library_window.h"
|
||||
|
||||
#include <QApplication>
|
||||
//#include "startup.h"
|
||||
#include "startup.h"
|
||||
#define PICTUREFLOW_QT4 1
|
||||
|
||||
//interfaz al servidor
|
||||
LibraryWindow * mw;
|
||||
|
||||
int main( int argc, char ** argv )
|
||||
{
|
||||
QApplication app( argc, argv );
|
||||
@ -14,12 +17,12 @@ int main( int argc, char ** argv )
|
||||
app.installTranslator(&translator);
|
||||
app.setApplicationName("YACReaderLibrary");
|
||||
|
||||
QMainWindow * mw = new LibraryWindow();
|
||||
mw = new LibraryWindow();
|
||||
mw->resize(800,480);
|
||||
mw->showMaximized();
|
||||
|
||||
//Startup * s = new Startup();
|
||||
//s->start();
|
||||
Startup * s = new Startup();
|
||||
s->start();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
41
YACReaderLibrary/server/controllers/covercontroller.cpp
Normal file
41
YACReaderLibrary/server/controllers/covercontroller.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
#include "covercontroller.h"
|
||||
#include "library_window.h" //get libraries
|
||||
|
||||
#include "template.h"
|
||||
#include "../static.h"
|
||||
|
||||
extern LibraryWindow * mw;
|
||||
|
||||
CoverController::CoverController() {}
|
||||
|
||||
void CoverController::service(HttpRequest& request, HttpResponse& response)
|
||||
{
|
||||
response.setHeader("Content-Type", "image/jpeg");
|
||||
|
||||
//response.setHeader("Content-Type", "plain/text; charset=ISO-8859-1");
|
||||
|
||||
QMap<QString,QString> libraries = mw->getLibraries();
|
||||
|
||||
QString path = request.getPath();
|
||||
QStringList pathElements = path.split('/');
|
||||
QString libraryName = pathElements.at(2);
|
||||
QString fileName = pathElements.at(4);
|
||||
|
||||
//response.writeText(path+"<br/>");
|
||||
//response.writeText(libraryName+"<br/>");
|
||||
//response.writeText(libraries.value(libraryName)+"/.yacreaderlibrary/covers/"+fileName+"<br/>");
|
||||
|
||||
QFile file(libraries.value(libraryName)+"/.yacreaderlibrary/covers/"+fileName);
|
||||
if (file.exists()) {
|
||||
if (file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
qDebug("StaticFileController: Open file %s",qPrintable(file.fileName()));
|
||||
// Return the file content, do not store in cache
|
||||
while (!file.atEnd() && !file.error()) {
|
||||
response.write(file.read(65536));
|
||||
}
|
||||
}
|
||||
|
||||
file.close();
|
||||
}
|
||||
}
|
20
YACReaderLibrary/server/controllers/covercontroller.h
Normal file
20
YACReaderLibrary/server/controllers/covercontroller.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef COVERCONTROLLER_H
|
||||
#define COVERCONTROLLER_H
|
||||
|
||||
#include "httprequest.h"
|
||||
#include "httpresponse.h"
|
||||
#include "httprequesthandler.h"
|
||||
|
||||
class CoverController : public HttpRequestHandler {
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(CoverController);
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
CoverController();
|
||||
|
||||
/** Generates the response */
|
||||
void service(HttpRequest& request, HttpResponse& response);
|
||||
};
|
||||
|
||||
#endif // COVERCONTROLLER_H
|
136
YACReaderLibrary/server/controllers/foldercontroller.cpp
Normal file
136
YACReaderLibrary/server/controllers/foldercontroller.cpp
Normal file
@ -0,0 +1,136 @@
|
||||
#include "foldercontroller.h"
|
||||
#include "library_window.h" //get libraries
|
||||
|
||||
#include "folder.h"
|
||||
|
||||
#include "template.h"
|
||||
#include "../static.h"
|
||||
|
||||
extern LibraryWindow * mw;
|
||||
|
||||
FolderController::FolderController() {}
|
||||
|
||||
void FolderController::service(HttpRequest& request, HttpResponse& response)
|
||||
{
|
||||
response.setHeader("Content-Type", "text/html; charset=ISO-8859-1");
|
||||
|
||||
Template t=Static::templateLoader->getTemplate("folder",request.getHeader("Accept-Language"));
|
||||
t.enableWarnings();
|
||||
QString path = request.getPath();
|
||||
QStringList pathElements = path.split('/');
|
||||
QString libraryName = pathElements.at(2);
|
||||
qulonglong parentId = pathElements.at(4).toULongLong();
|
||||
QList<LibraryItem *> folderContent = mw->getFolderContentFromLibrary(libraryName,parentId);
|
||||
QList<LibraryItem *> folderComics = mw->getFolderComicsFromLibrary(libraryName,parentId);
|
||||
|
||||
qulonglong backId = mw->getParentFromComicFolderId(libraryName,parentId);
|
||||
if(backId == 1 && parentId == 1)
|
||||
t.setVariable(QString("upurl"),"/");
|
||||
else
|
||||
t.setVariable(QString("upurl"),"/library/" + libraryName + "/folder/" +QString("%1").arg(backId));
|
||||
|
||||
int page = 0;
|
||||
QByteArray p = request.getParameter("page");
|
||||
if(p.length() != 0)
|
||||
page = p.toInt();
|
||||
|
||||
//t.loop("element",folderContent.length());
|
||||
|
||||
int elementsPerPage = 10;
|
||||
|
||||
int numFolders = folderContent.length();
|
||||
int numComics = folderComics.length();
|
||||
int totalLength = folderContent.length() + folderComics.length();
|
||||
|
||||
int numFolderPages = numFolders / 10 + ((numFolders%10)>0?1:0);
|
||||
int numPages = totalLength / 10 + ((totalLength%10)>0?1:0);
|
||||
|
||||
response.writeText(QString("Number of pages : %1 <br/>").arg(numPages));
|
||||
|
||||
if(page < 0)
|
||||
page = 0;
|
||||
else if(page >= numPages)
|
||||
page = numPages-1;
|
||||
|
||||
int indexCurrentPage = page*10;
|
||||
int numFoldersAtCurrentPage = qMax(0,qMin(numFolders - indexCurrentPage, 10));
|
||||
|
||||
//response.writeText(QString("indexCurrentPage : %1 <br/>").arg(indexCurrentPage));
|
||||
//response.writeText(QString("numFoldersAtCurrentPage : %1 <br/>").arg(numFoldersAtCurrentPage));
|
||||
//response.writeText(QString("foldersLength : %1 <br/>").arg(folderContent.length()));
|
||||
|
||||
t.loop("element",numFoldersAtCurrentPage);
|
||||
int i = 0;
|
||||
while(i<numFoldersAtCurrentPage)
|
||||
{
|
||||
t.setVariable(QString("element%1.name").arg(i),folderContent.at(i + (page*10))->name);
|
||||
t.setVariable(QString("element%1.url").arg(i),"/library/"+libraryName+"/folder/"+QString("%1").arg(folderContent.at(i + (page*10))->id));
|
||||
i++;
|
||||
}
|
||||
|
||||
int comicsOffset;// = qMax(0,((page - (numFolderPages - 1)) * 10) - (numFolders%10));
|
||||
|
||||
int comicPage = numFolderPages!=0?page-(numFolderPages - 1):page;
|
||||
|
||||
if(comicPage > 0)
|
||||
{
|
||||
comicsOffset = 10 - (numFolders%10);
|
||||
comicsOffset += (comicPage-1) *10;
|
||||
}
|
||||
else
|
||||
comicsOffset = 0;
|
||||
|
||||
|
||||
|
||||
int globalComicsOffset = 10 - (numFolders%10);
|
||||
int numComicsAtCurrentPage = 0;
|
||||
|
||||
if(comicPage == 0) //primera página de los cómics
|
||||
numComicsAtCurrentPage = qMin(globalComicsOffset,numComics);
|
||||
else if (page == (numPages-1)) //última página de los cómics
|
||||
numComicsAtCurrentPage = 10-globalComicsOffset + (numComics%10);
|
||||
else
|
||||
numComicsAtCurrentPage = 10 - numFoldersAtCurrentPage;
|
||||
|
||||
if(numComics == 0)
|
||||
numComicsAtCurrentPage = 0;
|
||||
response.writeText(QString("numComicsAtCurrentPage : %1 <br/>").arg(numComicsAtCurrentPage));
|
||||
response.writeText(QString("comicsOffset : %1 <br/>").arg(comicsOffset));
|
||||
|
||||
t.loop("elementcomic",numComicsAtCurrentPage);
|
||||
//
|
||||
int j = 0;
|
||||
|
||||
while(j<numComicsAtCurrentPage)
|
||||
{
|
||||
const Comic * comic = (Comic *)folderComics.at(j+comicsOffset);
|
||||
//if(comic->info.title == 0 || comic->info.title->isEmpty())
|
||||
t.setVariable(QString("elementcomic%1.name").arg(j),comic->name);
|
||||
//else
|
||||
// t.setVariable(QString("elementcomic%1.name").arg(i),*comic->info.title);
|
||||
t.setVariable(QString("elementcomic%1.url").arg(j),"/library/"+libraryName+"/comic/"+QString("%1").arg(comic->id));
|
||||
t.setVariable(QString("elementcomic%1.coverulr").arg(j),"/library/"+libraryName+"/cover/"+QString("%1").arg(comic->info.hash + ".jpg"));
|
||||
j++;
|
||||
}
|
||||
|
||||
if(numPages > 1)
|
||||
{
|
||||
t.loop("page",numPages);
|
||||
int z = 0;
|
||||
while(z < numPages)
|
||||
{
|
||||
|
||||
t.setVariable(QString("page%1.url").arg(z),"/library/"+libraryName+"/folder/"+QString("%1").arg(parentId)+QString("?page=%1").arg(z));
|
||||
if(page == z)
|
||||
t.setVariable(QString("page%1.number").arg(z),QString("<strong>%1</strong>").arg(z));
|
||||
else
|
||||
t.setVariable(QString("page%1.number").arg(z),QString("%1").arg(z));
|
||||
z++;
|
||||
}
|
||||
}
|
||||
else
|
||||
t.loop("page",0);
|
||||
|
||||
response.write(t.toLatin1(),true);
|
||||
|
||||
}
|
20
YACReaderLibrary/server/controllers/foldercontroller.h
Normal file
20
YACReaderLibrary/server/controllers/foldercontroller.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef FOLDERCONTROLLER_H
|
||||
#define FOLDERCONTROLLER_H
|
||||
|
||||
#include "httprequest.h"
|
||||
#include "httpresponse.h"
|
||||
#include "httprequesthandler.h"
|
||||
|
||||
class FolderController : public HttpRequestHandler {
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(FolderController);
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
FolderController();
|
||||
|
||||
/** Generates the response */
|
||||
void service(HttpRequest& request, HttpResponse& response);
|
||||
};
|
||||
|
||||
#endif // FOLDERCONTROLLER_H
|
@ -1,17 +1,48 @@
|
||||
/**
|
||||
/**
|
||||
@file
|
||||
@author Stefan Frings
|
||||
*/
|
||||
|
||||
#include "formcontroller.h"
|
||||
#include <QStringList>
|
||||
|
||||
FormController::FormController() {}
|
||||
|
||||
void FormController::service(HttpRequest& request, HttpResponse& response) {
|
||||
|
||||
response.setHeader("Content-Type", "text/html; charset=ISO-8859-1");
|
||||
response.setHeader("Content-Type", "text/html; charset=utf-8");
|
||||
|
||||
if (request.getParameter("action")=="show") {
|
||||
QString data(request.getBody());
|
||||
|
||||
QStringList list = data.split("\n");
|
||||
|
||||
response.write("<html><body>");
|
||||
response.writeText("á é í ó ú ñ -> \\ /Device type: "+list.first());
|
||||
|
||||
//test background proccesing
|
||||
/*int i=0;
|
||||
int j=0;
|
||||
while(i<1000000000)
|
||||
{
|
||||
if(request.getBody().length()>1)
|
||||
j++;
|
||||
else
|
||||
i++;
|
||||
if(i%1000000 == 0)
|
||||
response.write("<p> lista </p>");
|
||||
}*/
|
||||
|
||||
response.write("<p> lista </p>");
|
||||
|
||||
response.write("<ul>");
|
||||
|
||||
for(int i=1;i<list.length();i++)
|
||||
{
|
||||
response.writeText("<li>"+list.at(i)+"</li>");
|
||||
}
|
||||
response.write("</ul></body></html>",true);
|
||||
|
||||
/*if (request.getParameter("action")=="show") {
|
||||
response.write("<html><body>");
|
||||
response.write("Name = ");
|
||||
response.write(request.getParameter("name"));
|
||||
@ -28,6 +59,6 @@ void FormController::service(HttpRequest& request, HttpResponse& response) {
|
||||
response.write(" <input type=\"submit\">");
|
||||
response.write("</form>");
|
||||
response.write("</body></html>",true);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
31
YACReaderLibrary/server/controllers/librariescontroller.cpp
Normal file
31
YACReaderLibrary/server/controllers/librariescontroller.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
#include "librariescontroller.h"
|
||||
#include "library_window.h" //get libraries
|
||||
|
||||
#include "template.h"
|
||||
#include "../static.h"
|
||||
|
||||
extern LibraryWindow * mw;
|
||||
|
||||
LibrariesController::LibrariesController() {}
|
||||
|
||||
void LibrariesController::service(HttpRequest& request, HttpResponse& response)
|
||||
{
|
||||
response.setHeader("Content-Type", "text/html; charset=ISO-8859-1");
|
||||
|
||||
Template t=Static::templateLoader->getTemplate("libraries",request.getHeader("Accept-Language"));
|
||||
t.enableWarnings();
|
||||
|
||||
QMap<QString,QString> libraries = mw->getLibraries();
|
||||
QList<QString> names = libraries.keys();
|
||||
|
||||
t.loop("library",names.length());
|
||||
int i=0;
|
||||
while (i<names.length()) {
|
||||
t.setVariable(QString("library%1.name").arg(i),names.at(i));
|
||||
t.setVariable(QString("library%1.label").arg(i),names.at(i));
|
||||
i++;
|
||||
}
|
||||
|
||||
response.write(t.toLatin1(),true);
|
||||
|
||||
}
|
25
YACReaderLibrary/server/controllers/librariescontroller.h
Normal file
25
YACReaderLibrary/server/controllers/librariescontroller.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef LIBRARIESCONTROLLER_H
|
||||
#define LIBRARIESCONTROLLER_H
|
||||
|
||||
#include "httprequest.h"
|
||||
#include "httpresponse.h"
|
||||
#include "httprequesthandler.h"
|
||||
|
||||
/**
|
||||
This controller displays a HTML form and dumps the submitted input.
|
||||
*/
|
||||
|
||||
|
||||
class LibrariesController : public HttpRequestHandler {
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(LibrariesController);
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
LibrariesController();
|
||||
|
||||
/** Generates the response */
|
||||
void service(HttpRequest& request, HttpResponse& response);
|
||||
};
|
||||
|
||||
#endif // LIBRARIESCONTROLLER_H
|
@ -26,7 +26,8 @@ HttpConnectionHandler* HttpConnectionHandlerPool::getConnectionHandler() {
|
||||
}
|
||||
}
|
||||
if (!freeHandler) {
|
||||
int maxConnectionHandlers=settings->value("maxThreads",10).toInt();
|
||||
//CAMBIADO
|
||||
int maxConnectionHandlers= 100;//settings->value("maxThreads",10).toInt();
|
||||
if (pool.count()<maxConnectionHandlers) {
|
||||
freeHandler=new HttpConnectionHandler(settings,requestHandler);
|
||||
pool.append(freeHandler);
|
||||
|
@ -50,6 +50,7 @@ void HttpListener::incomingConnection(int socketDescriptor) {
|
||||
QTcpSocket* socket=new QTcpSocket(this);
|
||||
socket->setSocketDescriptor(socketDescriptor);
|
||||
connect(socket, SIGNAL(disconnected()), socket, SLOT(deleteLater()));
|
||||
//CAMBIADO 503 por 429
|
||||
socket->write("HTTP/1.1 503 too many connections\r\nConnection: close\r\n\r\nToo many connections\r\n");
|
||||
socket->disconnectFromHost();
|
||||
}
|
||||
|
@ -104,6 +104,11 @@ void HttpResponse::write(QByteArray data, bool lastPart) {
|
||||
}
|
||||
}
|
||||
|
||||
void HttpResponse::writeText(QString text, bool lastPart)
|
||||
{
|
||||
write(text.toAscii(),lastPart);
|
||||
}
|
||||
|
||||
|
||||
bool HttpResponse::hasSentLastPart() const {
|
||||
return sentLastPart;
|
||||
|
@ -83,6 +83,7 @@ public:
|
||||
@param lastPart Indicator, if this is the last part of the response.
|
||||
*/
|
||||
void write(QByteArray data, bool lastPart=false);
|
||||
void writeText(QString text, bool lastPart=false);
|
||||
|
||||
/**
|
||||
Indicates wheter the body has been sent completely. Used by the connection
|
||||
|
@ -119,6 +119,8 @@ void StaticFileController::setContentType(QString fileName, HttpResponse& respon
|
||||
else if (fileName.endsWith(".html") || fileName.endsWith(".htm")) {
|
||||
response.setHeader("Content-Type", qPrintable("text/html; charset=charset="+encoding));
|
||||
}
|
||||
else if (fileName.endsWith(".js"))
|
||||
response.setHeader("Content-Type", qPrintable("text/javascript; charset=charset="+encoding));
|
||||
// Todo: add all of your content types
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,10 @@
|
||||
#include "controllers/fileuploadcontroller.h"
|
||||
#include "controllers/sessioncontroller.h"
|
||||
|
||||
#include "controllers/librariescontroller.h"
|
||||
#include "controllers/foldercontroller.h"
|
||||
#include "controllers/covercontroller.h"
|
||||
|
||||
RequestMapper::RequestMapper(QObject* parent)
|
||||
:HttpRequestHandler(parent) {}
|
||||
|
||||
@ -19,28 +23,47 @@ void RequestMapper::service(HttpRequest& request, HttpResponse& response) {
|
||||
QByteArray path=request.getPath();
|
||||
qDebug("RequestMapper: path=%s",path.data());
|
||||
|
||||
if (path.startsWith("/dump")) {
|
||||
DumpController().service(request, response);
|
||||
}
|
||||
//primera petición, se ha hecho un post, se sirven las bibliotecas si la seguridad mediante login no está habilitada
|
||||
if(path == "/")
|
||||
{
|
||||
LibrariesController().service(request, response);
|
||||
}
|
||||
|
||||
else if (path.startsWith("/template")) {
|
||||
TemplateController().service(request, response);
|
||||
}
|
||||
//listar el contenido del folder
|
||||
if(path.contains("folder") && !path.contains("info"))
|
||||
{
|
||||
FolderController().service(request, response);
|
||||
}
|
||||
|
||||
else if (path.startsWith("/form")) {
|
||||
FormController().service(request, response);
|
||||
}
|
||||
if(path.contains("cover") )
|
||||
{
|
||||
CoverController().service(request, response);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (path.startsWith("/dump")) {
|
||||
DumpController().service(request, response);
|
||||
}
|
||||
|
||||
else if (path.startsWith("/file")) {
|
||||
FileUploadController().service(request, response);
|
||||
}
|
||||
else if (path.startsWith("/template")) {
|
||||
TemplateController().service(request, response);
|
||||
}
|
||||
|
||||
else if (path.startsWith("/session")) {
|
||||
SessionController().service(request, response);
|
||||
}
|
||||
else if (path.startsWith("/form")) {
|
||||
FormController().service(request, response);
|
||||
}
|
||||
|
||||
// All other pathes are mapped to the static file controller.
|
||||
else {
|
||||
Static::staticFileController->service(request, response);
|
||||
}
|
||||
else if (path.startsWith("/file")) {
|
||||
FileUploadController().service(request, response);
|
||||
}
|
||||
|
||||
else if (path.startsWith("/session")) {
|
||||
SessionController().service(request, response);
|
||||
}
|
||||
|
||||
// All other pathes are mapped to the static file controller.
|
||||
else {
|
||||
Static::staticFileController->service(request, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,15 @@ HEADERS += \
|
||||
$$PWD/controllers/templatecontroller.h \
|
||||
$$PWD/controllers/formcontroller.h \
|
||||
$$PWD/controllers/fileuploadcontroller.h \
|
||||
$$PWD/controllers/sessioncontroller.h
|
||||
$$PWD/controllers/sessioncontroller.h \
|
||||
$$PWD/controllers/comiccontroller.h \
|
||||
$$PWD/controllers/errorcontroller.h \
|
||||
$$PWD/controllers/foldercontroller.h \
|
||||
$$PWD/controllers/folderinfocontroller.h \
|
||||
$$PWD/controllers/librariescontroller.h \
|
||||
$$PWD/controllers/pagecontroller.h \
|
||||
$$PWD/controllers/sessionmanager.h \
|
||||
$$PWD/controllers/covercontroller.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/static.cpp \
|
||||
@ -19,7 +27,15 @@ SOURCES += \
|
||||
$$PWD/controllers/templatecontroller.cpp \
|
||||
$$PWD/controllers/formcontroller.cpp \
|
||||
$$PWD/controllers/fileuploadcontroller.cpp \
|
||||
$$PWD/controllers/sessioncontroller.cpp
|
||||
$$PWD/controllers/sessioncontroller.cpp \
|
||||
$$PWD/controllers/comiccontroller.cpp \
|
||||
$$PWD/controllers/errorcontroller.cpp \
|
||||
$$PWD/controllers/foldercontroller.cpp \
|
||||
$$PWD/controllers/folderinfocontroller.cpp \
|
||||
$$PWD/controllers/librariescontroller.cpp \
|
||||
$$PWD/controllers/pagecontroller.cpp \
|
||||
$$PWD/controllers/sessionmanager.cpp \
|
||||
$$PWD/controllers/covercontroller.cpp
|
||||
|
||||
include(lib/bfLogging/bfLogging.pri)
|
||||
include(lib/bfHttpServer/bfHttpServer.pri)
|
||||
|
26
release/server/docroot/login.html
Normal file
26
release/server/docroot/login.html
Normal file
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<link rel="stylesheet" href="css/reset.css" type="text/css" />
|
||||
<link rel="stylesheet" href="css/styles.css" type="text/css" />
|
||||
<title>Login</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
|
||||
<h1>LOGIN</h1>
|
||||
<h2>YACREADER LIBRARY</h2>
|
||||
|
||||
<form>
|
||||
<div class="inputs_login">
|
||||
<input type="text" class="username" value="username" name="username" />
|
||||
<input type="text" class="pass" value="password" name="pass" />
|
||||
</div>
|
||||
<input class="button_sign" type="submit" value="Sign in" />
|
||||
<p class="infor">If you have forgotten your login information, please reset it on the YACReaderLibrary</p>
|
||||
<div class="clear"> </div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="sombra"> </div>
|
||||
</body>
|
||||
</html>
|
19
release/server/templates/folder.tpl
Normal file
19
release/server/templates/folder.tpl
Normal file
@ -0,0 +1,19 @@
|
||||
<html>
|
||||
<body>
|
||||
<h1>Folder</h1>
|
||||
<a href="{upurl}">up</a>
|
||||
|
||||
<ul id="itemContainer">
|
||||
{loop element}
|
||||
<li><a href="{element.url}">{element.name}</a></li>
|
||||
{end element}
|
||||
|
||||
{loop elementcomic}
|
||||
<li><img style="width: 100px" src="{elementcomic.coverulr}" /> <a href="{elementcomic.url}">{elementcomic.name}</a></li>
|
||||
{end elementcomic}
|
||||
</ul>
|
||||
|
||||
<div>{loop page} <a href="{page.url}"> {page.number} </a> {end page}</div>
|
||||
|
||||
</body>
|
||||
</html>
|
13
release/server/templates/libraries-es.tpl
Normal file
13
release/server/templates/libraries-es.tpl
Normal file
@ -0,0 +1,13 @@
|
||||
<html>
|
||||
|
||||
<body>
|
||||
<h1>Bibliotecas</h1>
|
||||
<p>
|
||||
<ul>
|
||||
{loop library}
|
||||
<li><a href="/library/{library.name}/folder/1">{library.label}</a></li>
|
||||
{end library}
|
||||
</ul>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
13
release/server/templates/libraries.tpl
Normal file
13
release/server/templates/libraries.tpl
Normal file
@ -0,0 +1,13 @@
|
||||
<html>
|
||||
|
||||
<body>
|
||||
<h1>Libraries</h1>
|
||||
<p>
|
||||
<ul>
|
||||
{loop library}
|
||||
<li><a href="/library/{library.name}/folder/1">{library.label}</a></li>
|
||||
{end library}
|
||||
</ul>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user