From cbee662df4ca247d0dd624443bbdfcf51c3c75d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Wed, 5 Sep 2012 19:41:52 +0200 Subject: [PATCH] antes de a?adir la clase Comic de YACReader a YACReaderLibrary navegaci?n web con paginaci?n rudimentaria implementada --- YACReaderLibrary/db/folder.cpp | 17 +++ YACReaderLibrary/db/folder.h | 1 + YACReaderLibrary/library_window.cpp | 34 +++++ YACReaderLibrary/library_window.h | 6 + YACReaderLibrary/main.cpp | 11 +- .../server/controllers/comiccontroller.cpp | 0 .../server/controllers/comiccontroller.h | 0 .../server/controllers/covercontroller.cpp | 41 ++++++ .../server/controllers/covercontroller.h | 20 +++ .../server/controllers/errorcontroller.cpp | 0 .../server/controllers/errorcontroller.h | 0 .../server/controllers/foldercontroller.cpp | 136 ++++++++++++++++++ .../server/controllers/foldercontroller.h | 20 +++ .../controllers/folderinfocontroller.cpp | 0 .../server/controllers/folderinfocontroller.h | 0 .../server/controllers/formcontroller.cpp | 39 ++++- .../controllers/librariescontroller.cpp | 31 ++++ .../server/controllers/librariescontroller.h | 25 ++++ .../server/controllers/pagecontroller.cpp | 0 .../server/controllers/pagecontroller.h | 0 .../server/controllers/sessionmanager.cpp | 0 .../server/controllers/sessionmanager.h | 0 .../httpconnectionhandlerpool.cpp | 3 +- .../server/lib/bfHttpServer/httplistener.cpp | 1 + .../server/lib/bfHttpServer/httpresponse.cpp | 5 + .../server/lib/bfHttpServer/httpresponse.h | 1 + .../lib/bfHttpServer/staticfilecontroller.cpp | 2 + YACReaderLibrary/server/requestmapper.cpp | 61 +++++--- YACReaderLibrary/server/server.pri | 20 ++- release/server/docroot/login.html | 26 ++++ release/server/templates/folder.tpl | 19 +++ release/server/templates/libraries-es.tpl | 13 ++ release/server/templates/libraries.tpl | 13 ++ 33 files changed, 515 insertions(+), 30 deletions(-) create mode 100644 YACReaderLibrary/server/controllers/comiccontroller.cpp create mode 100644 YACReaderLibrary/server/controllers/comiccontroller.h create mode 100644 YACReaderLibrary/server/controllers/covercontroller.cpp create mode 100644 YACReaderLibrary/server/controllers/covercontroller.h create mode 100644 YACReaderLibrary/server/controllers/errorcontroller.cpp create mode 100644 YACReaderLibrary/server/controllers/errorcontroller.h create mode 100644 YACReaderLibrary/server/controllers/foldercontroller.cpp create mode 100644 YACReaderLibrary/server/controllers/foldercontroller.h create mode 100644 YACReaderLibrary/server/controllers/folderinfocontroller.cpp create mode 100644 YACReaderLibrary/server/controllers/folderinfocontroller.h create mode 100644 YACReaderLibrary/server/controllers/librariescontroller.cpp create mode 100644 YACReaderLibrary/server/controllers/librariescontroller.h create mode 100644 YACReaderLibrary/server/controllers/pagecontroller.cpp create mode 100644 YACReaderLibrary/server/controllers/pagecontroller.h create mode 100644 YACReaderLibrary/server/controllers/sessionmanager.cpp create mode 100644 YACReaderLibrary/server/controllers/sessionmanager.h create mode 100644 release/server/docroot/login.html create mode 100644 release/server/templates/folder.tpl create mode 100644 release/server/templates/libraries-es.tpl create mode 100644 release/server/templates/libraries.tpl diff --git a/YACReaderLibrary/db/folder.cpp b/YACReaderLibrary/db/folder.cpp index cf0fbdb8..b0b13c01 100644 --- a/YACReaderLibrary/db/folder.cpp +++ b/YACReaderLibrary/db/folder.cpp @@ -4,6 +4,23 @@ #include #include +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); diff --git a/YACReaderLibrary/db/folder.h b/YACReaderLibrary/db/folder.h index dba5c44c..a9c39ea5 100644 --- a/YACReaderLibrary/db/folder.h +++ b/YACReaderLibrary/db/folder.h @@ -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 getFoldersFromParent(qulonglong parentId, QSqlDatabase & db); diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index b60ce027..a124c51b 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -1331,4 +1331,38 @@ void LibraryWindow::showImportComicsInfo() { importComicsInfoDialog->dest = currentPath() + "/.yacreaderlibrary/library.ydb"; importComicsInfoDialog->show(); +} + +QList LibraryWindow::getFolderContentFromLibrary(const QString & libraryName, qulonglong folderId) +{ + QSqlDatabase db = DataBaseManagement::loadDatabase(libraries.value(libraryName)+"/.yacreaderlibrary"); + + QList list = Folder::getFoldersFromParent(folderId,db); + + db.close(); + QSqlDatabase::removeDatabase(libraries.value(libraryName)); + return list; + +} + +QList LibraryWindow::getFolderComicsFromLibrary(const QString & libraryName, qulonglong folderId) +{ + QSqlDatabase db = DataBaseManagement::loadDatabase(libraries.value(libraryName)+"/.yacreaderlibrary"); + + QList 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; } \ No newline at end of file diff --git a/YACReaderLibrary/library_window.h b/YACReaderLibrary/library_window.h index 29fb491b..0364d017 100644 --- a/YACReaderLibrary/library_window.h +++ b/YACReaderLibrary/library_window.h @@ -199,6 +199,12 @@ public: void showExportComicsInfo(); void showImportComicsInfo(); void asignNumbers(); + + //server interface + QMap getLibraries(){return libraries;}; + QList getFolderContentFromLibrary(const QString & libraryName, qulonglong folderId); + QList getFolderComicsFromLibrary(const QString & libraryName, qulonglong folderId); + qulonglong getParentFromComicFolderId(const QString & libraryName, qulonglong id); }; #endif diff --git a/YACReaderLibrary/main.cpp b/YACReaderLibrary/main.cpp index 85aa9f30..0504f598 100644 --- a/YACReaderLibrary/main.cpp +++ b/YACReaderLibrary/main.cpp @@ -1,9 +1,12 @@ #include "library_window.h" #include -//#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(); } diff --git a/YACReaderLibrary/server/controllers/comiccontroller.cpp b/YACReaderLibrary/server/controllers/comiccontroller.cpp new file mode 100644 index 00000000..e69de29b diff --git a/YACReaderLibrary/server/controllers/comiccontroller.h b/YACReaderLibrary/server/controllers/comiccontroller.h new file mode 100644 index 00000000..e69de29b diff --git a/YACReaderLibrary/server/controllers/covercontroller.cpp b/YACReaderLibrary/server/controllers/covercontroller.cpp new file mode 100644 index 00000000..b2e34186 --- /dev/null +++ b/YACReaderLibrary/server/controllers/covercontroller.cpp @@ -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 libraries = mw->getLibraries(); + + QString path = request.getPath(); + QStringList pathElements = path.split('/'); + QString libraryName = pathElements.at(2); + QString fileName = pathElements.at(4); + + //response.writeText(path+"
"); + //response.writeText(libraryName+"
"); + //response.writeText(libraries.value(libraryName)+"/.yacreaderlibrary/covers/"+fileName+"
"); + + 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(); + } +} \ No newline at end of file diff --git a/YACReaderLibrary/server/controllers/covercontroller.h b/YACReaderLibrary/server/controllers/covercontroller.h new file mode 100644 index 00000000..d4948f7c --- /dev/null +++ b/YACReaderLibrary/server/controllers/covercontroller.h @@ -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 diff --git a/YACReaderLibrary/server/controllers/errorcontroller.cpp b/YACReaderLibrary/server/controllers/errorcontroller.cpp new file mode 100644 index 00000000..e69de29b diff --git a/YACReaderLibrary/server/controllers/errorcontroller.h b/YACReaderLibrary/server/controllers/errorcontroller.h new file mode 100644 index 00000000..e69de29b diff --git a/YACReaderLibrary/server/controllers/foldercontroller.cpp b/YACReaderLibrary/server/controllers/foldercontroller.cpp new file mode 100644 index 00000000..824755c6 --- /dev/null +++ b/YACReaderLibrary/server/controllers/foldercontroller.cpp @@ -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 folderContent = mw->getFolderContentFromLibrary(libraryName,parentId); + QList 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
").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
").arg(indexCurrentPage)); + //response.writeText(QString("numFoldersAtCurrentPage : %1
").arg(numFoldersAtCurrentPage)); + //response.writeText(QString("foldersLength : %1
").arg(folderContent.length())); + + t.loop("element",numFoldersAtCurrentPage); + int i = 0; + while(iname); + 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
").arg(numComicsAtCurrentPage)); + response.writeText(QString("comicsOffset : %1
").arg(comicsOffset)); + + t.loop("elementcomic",numComicsAtCurrentPage); + // + int j = 0; + + while(jinfo.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("%1").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); + +} \ No newline at end of file diff --git a/YACReaderLibrary/server/controllers/foldercontroller.h b/YACReaderLibrary/server/controllers/foldercontroller.h new file mode 100644 index 00000000..4d757869 --- /dev/null +++ b/YACReaderLibrary/server/controllers/foldercontroller.h @@ -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 diff --git a/YACReaderLibrary/server/controllers/folderinfocontroller.cpp b/YACReaderLibrary/server/controllers/folderinfocontroller.cpp new file mode 100644 index 00000000..e69de29b diff --git a/YACReaderLibrary/server/controllers/folderinfocontroller.h b/YACReaderLibrary/server/controllers/folderinfocontroller.h new file mode 100644 index 00000000..e69de29b diff --git a/YACReaderLibrary/server/controllers/formcontroller.cpp b/YACReaderLibrary/server/controllers/formcontroller.cpp index bcfebd66..7a0f2b27 100644 --- a/YACReaderLibrary/server/controllers/formcontroller.cpp +++ b/YACReaderLibrary/server/controllers/formcontroller.cpp @@ -1,17 +1,48 @@ -/** +/** @file @author Stefan Frings */ #include "formcontroller.h" +#include 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(""); + 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("

lista

"); + }*/ + + response.write("

lista

"); + + response.write("
    "); + + for(int i=1;i"+list.at(i)+""); + } + response.write("
",true); + + /*if (request.getParameter("action")=="show") { response.write(""); response.write("Name = "); response.write(request.getParameter("name")); @@ -28,6 +59,6 @@ void FormController::service(HttpRequest& request, HttpResponse& response) { response.write(" "); response.write(""); response.write("",true); - } + }*/ } diff --git a/YACReaderLibrary/server/controllers/librariescontroller.cpp b/YACReaderLibrary/server/controllers/librariescontroller.cpp new file mode 100644 index 00000000..8cfc459c --- /dev/null +++ b/YACReaderLibrary/server/controllers/librariescontroller.cpp @@ -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 libraries = mw->getLibraries(); + QList names = libraries.keys(); + + t.loop("library",names.length()); + int i=0; + while (ivalue("maxThreads",10).toInt(); + //CAMBIADO + int maxConnectionHandlers= 100;//settings->value("maxThreads",10).toInt(); if (pool.count()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(); } diff --git a/YACReaderLibrary/server/lib/bfHttpServer/httpresponse.cpp b/YACReaderLibrary/server/lib/bfHttpServer/httpresponse.cpp index efa3ee8a..3c6ea03b 100644 --- a/YACReaderLibrary/server/lib/bfHttpServer/httpresponse.cpp +++ b/YACReaderLibrary/server/lib/bfHttpServer/httpresponse.cpp @@ -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; diff --git a/YACReaderLibrary/server/lib/bfHttpServer/httpresponse.h b/YACReaderLibrary/server/lib/bfHttpServer/httpresponse.h index 3c28a903..14c54a88 100644 --- a/YACReaderLibrary/server/lib/bfHttpServer/httpresponse.h +++ b/YACReaderLibrary/server/lib/bfHttpServer/httpresponse.h @@ -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 diff --git a/YACReaderLibrary/server/lib/bfHttpServer/staticfilecontroller.cpp b/YACReaderLibrary/server/lib/bfHttpServer/staticfilecontroller.cpp index 6ffc10a3..670682ce 100644 --- a/YACReaderLibrary/server/lib/bfHttpServer/staticfilecontroller.cpp +++ b/YACReaderLibrary/server/lib/bfHttpServer/staticfilecontroller.cpp @@ -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 } diff --git a/YACReaderLibrary/server/requestmapper.cpp b/YACReaderLibrary/server/requestmapper.cpp index 107cba28..59755b33 100644 --- a/YACReaderLibrary/server/requestmapper.cpp +++ b/YACReaderLibrary/server/requestmapper.cpp @@ -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); + } + } } diff --git a/YACReaderLibrary/server/server.pri b/YACReaderLibrary/server/server.pri index 1f4e5df4..4330dbe5 100644 --- a/YACReaderLibrary/server/server.pri +++ b/YACReaderLibrary/server/server.pri @@ -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) diff --git a/release/server/docroot/login.html b/release/server/docroot/login.html new file mode 100644 index 00000000..9d5e625d --- /dev/null +++ b/release/server/docroot/login.html @@ -0,0 +1,26 @@ + + + + + + Login + + +
+ +

LOGIN

+

YACREADER LIBRARY

+ +
+ + +

If you have forgotten your login information, please reset it on the YACReaderLibrary

+
 
+
+
+
 
+ + \ No newline at end of file diff --git a/release/server/templates/folder.tpl b/release/server/templates/folder.tpl new file mode 100644 index 00000000..a5b33a87 --- /dev/null +++ b/release/server/templates/folder.tpl @@ -0,0 +1,19 @@ + + +

Folder

+ up + + + +
{loop page} {page.number} {end page}
+ + + \ No newline at end of file diff --git a/release/server/templates/libraries-es.tpl b/release/server/templates/libraries-es.tpl new file mode 100644 index 00000000..22651263 --- /dev/null +++ b/release/server/templates/libraries-es.tpl @@ -0,0 +1,13 @@ + + + +

Bibliotecas

+

+

+

+ + \ No newline at end of file diff --git a/release/server/templates/libraries.tpl b/release/server/templates/libraries.tpl new file mode 100644 index 00000000..72a4bc9b --- /dev/null +++ b/release/server/templates/libraries.tpl @@ -0,0 +1,13 @@ + + + +

Libraries

+

+

+

+ + \ No newline at end of file