diff --git a/DOCS/Алексей/Board.md b/DOCS/Алексей/Board.md index 55eae26..5507615 100644 --- a/DOCS/Алексей/Board.md +++ b/DOCS/Алексей/Board.md @@ -6,6 +6,8 @@ kanban-plugin: board ## backLog +- [ ] окошко с выбором перенести в GUI +- [ ] Клиент НЕ СМОЖЕТ ВЫБИРАТЬ ВЕРСИИ ## bugs @@ -24,6 +26,7 @@ kanban-plugin: board - [ ] Иерархия проекта - папка application, папка updater и линк на основной экзешник - [ ] на старте все мониторы должны быть активны - [ ] Нужен ли дополнительный выбор для загрузки с мат моделью или нет? +- [ ] передавать полную версию в StreaminVerData ## feature server diff --git a/ServerLMS/Data/StreamingVersionData.h b/ServerLMS/Data/StreamingVersionData.h index 007b368..5cd2ffc 100644 --- a/ServerLMS/Data/StreamingVersionData.h +++ b/ServerLMS/Data/StreamingVersionData.h @@ -13,6 +13,7 @@ public: this->viewName = viewName; this->createData = data; this->size = size; + this->isChangeable = true; } ~StreamingVersionData(); @@ -36,8 +37,15 @@ public: return size; } - bool getIsChangeable() const; - void setIsChangeable(bool value); + bool getIsChangeable() const + { + return isChangeable; + } + + void setIsChangeable(bool value) + { + isChangeable = value; + } private: QString absolutePath; @@ -48,13 +56,3 @@ private: }; #endif // STREAMINGVERSIONDATA_H - -bool StreamingVersionData::getIsChangeable() const -{ -return isChangeable; -} - -void StreamingVersionData::setIsChangeable(bool value) -{ -isChangeable = value; -} diff --git a/ServerLMS/Systems/Parsers/processparser.cpp b/ServerLMS/Systems/Parsers/processparser.cpp index 7a94451..314d84a 100644 --- a/ServerLMS/Systems/Parsers/processparser.cpp +++ b/ServerLMS/Systems/Parsers/processparser.cpp @@ -239,6 +239,7 @@ void ProcessParser::clientMessage(QXmlStreamReader &xmlReader,ClientHandler *cli } processingSystem->processingFromClientMessage(client, clientMessage); + } void ProcessParser::clientNotify(QXmlStreamReader &xmlReader,ClientHandler *client) @@ -255,6 +256,8 @@ void ProcessParser::clientNotify(QXmlStreamReader &xmlReader,ClientHandler *clie clientNotify.Code = value; } + + processingSystem->processingClientNotify(client, clientNotify); } diff --git a/ServerLMS/Systems/processingsystem.cpp b/ServerLMS/Systems/processingsystem.cpp index ae055ab..87ee13c 100644 --- a/ServerLMS/Systems/processingsystem.cpp +++ b/ServerLMS/Systems/processingsystem.cpp @@ -8,11 +8,16 @@ ProcessingSystem::ProcessingSystem(ProviderDBLMS* providerDBLMS, QObject *parent this->providerDBLMS = providerDBLMS; } -void ProcessingSystem::initialize(ServerLMSWidget *server, DataParser *dataParser, CommonClientHandler *commonClientHandler,Logger *logger) +void ProcessingSystem::initialize(ServerLMSWidget *server, + DataParser *dataParser, + CommonClientHandler *commonClientHandler, + Logger *logger, + UpdateController *updateController) { this->commonClientServer = commonClientHandler; this->dataParser = dataParser; this->server = server; + this->updateController = updateController; connect(this,&ProcessingSystem::sigAuthChanged,commonClientHandler, &CommonClientHandler::slot_AuthChanged,Qt::AutoConnection); connect(this,&ProcessingSystem::sigUpdateListClients,server, &ServerLMSWidget::slotUpdateListClients,Qt::AutoConnection); @@ -278,6 +283,18 @@ void ProcessingSystem::processingClientNotify(ClientHandler *client, ClientNotif { client->sendVersionList(); } + else if(clientNotify.Code == commandCanChangeVersion) + { + if (updateController->getCurrentVersion()->getIsChangeable()) + { + client->sigSendNotify(commandChangable); + } + else + { + client->sigSendNotify(commandUnchangable); + } + + } } diff --git a/ServerLMS/Systems/processingsystem.h b/ServerLMS/Systems/processingsystem.h index 22dc00d..d5b82fb 100644 --- a/ServerLMS/Systems/processingsystem.h +++ b/ServerLMS/Systems/processingsystem.h @@ -23,7 +23,12 @@ class ProcessingSystem : public QObject public: explicit ProcessingSystem(ProviderDBLMS* providerDBLMS, QObject *parent = nullptr); - void initialize(ServerLMSWidget *server,DataParser* dataParser,CommonClientHandler *commonClientServer,Logger *logger); + void initialize(ServerLMSWidget *server, + DataParser* dataParser, + CommonClientHandler *commonClientServer, + Logger *logger, + UpdateController *updateComtroller); + void processingClientAutorization(ClientHandler *client, ClientAutorization clientAutorization); void processingClientDeAutorization(ClientHandler *client, ClientDeAutorization clientDeAutorization); void processingClientQueryToDB(ClientHandler *client, ClientQueryToDB clientQueryToDB, int id = 0, void* data = nullptr); @@ -44,7 +49,7 @@ private: CommonClientHandler *commonClientServer; ServerLMSWidget *server; DataParser *dataParser; - //InstructorsAndTraineesWidget *pInstructorsAndTrainees; + UpdateController *updateController; ProviderDBLMS* providerDBLMS; }; diff --git a/ServerLMS/Systems/recognizesystem.cpp b/ServerLMS/Systems/recognizesystem.cpp index 46e929d..be2e1d9 100644 --- a/ServerLMS/Systems/recognizesystem.cpp +++ b/ServerLMS/Systems/recognizesystem.cpp @@ -168,6 +168,16 @@ void RecognizeSystem::recognize() QFile file(filePath); +// //ПРОВЕРКА НА ИЗМЕНЕНИЕ БАЗОВОЙ ВЕРСИИ +// bool check = checkIsChangeable(); +// bool check2 = checkNonStaticData(filePath); +// if(!check && check2) +// { +// packetType = PacketType::TYPE_NONE; +// sendSystem->sendNotify(commandTryBaseChange); +// mutex->unlock(); +// return; +// } if (file.exists()) { @@ -239,6 +249,17 @@ void RecognizeSystem::recognize() break; } +// //ПРОВЕРКА НА ИЗМЕНЕНИЕ БАЗОВОЙ ВЕРСИИ +// bool check = checkIsChangeable(); +// bool check2 = checkNonStaticData(filePath); +// if(!check && check2) +// { +// sendSystem->sendNotify(commandTryBaseChange); +// packetType = PacketType::TYPE_NONE; +// mutex->unlock(); +// return; +// } + QFile file(filePath); QFileInfo fileInfo(file); @@ -412,6 +433,18 @@ QString RecognizeSystem::createFullPath(QString path) return fullPath; } +bool RecognizeSystem::checkIsChangeable() +{ + return updateController->getCurrentVersion()->getIsChangeable(); +} + +bool RecognizeSystem::checkNonStaticData(QString path) +{ + if(path.contains(sharedDataFolderName)) return true; + + return false; +} + RecognizeSystem::~RecognizeSystem() { diff --git a/ServerLMS/Systems/recognizesystem.h b/ServerLMS/Systems/recognizesystem.h index 7d5c97c..29a2b24 100644 --- a/ServerLMS/Systems/recognizesystem.h +++ b/ServerLMS/Systems/recognizesystem.h @@ -61,5 +61,7 @@ private: void packetTypeInit(PacketType packet,Client *client); void packetTypeInit(PacketType type); QString createFullPath(QString path); + bool checkIsChangeable(); + bool checkNonStaticData(QString path); }; #endif // RECOGNIZESYSTEM_H diff --git a/ServerLMS/Systems/tools.h b/ServerLMS/Systems/tools.h index e896664..1b9199d 100644 --- a/ServerLMS/Systems/tools.h +++ b/ServerLMS/Systems/tools.h @@ -27,6 +27,7 @@ static const QString clientHash = staticDataFolderName + "/clientHash.xml"; static const QString baseNameVersion = "base";//может вынести комманды куда нибудь? static const QString commandTryBaseDelete = "BASEDELETETRY"; +static const QString commandTryBaseChange = "TRYBASECHANGE"; static const QString commandTryActiveDelete = "TRYACTIVEDELETE"; static const QString commandTryCopyWithSameNames = "SAMENAMES"; static const QString commandGetServerDataList = "GETSERVERDATALIST"; @@ -35,6 +36,9 @@ static const QString commandReadyClient = "READY"; static const QString commandDisableClient = "DISABLE"; static const QString commandDuplicateVerName = "DUPLICATEVERNAME"; static const QString commandHashCompleteClient = "HASHSENDCOMPLETE"; +static const QString commandCanChangeVersion = "CANCHANGE"; +static const QString commandChangable = "CHANGEABLE"; +static const QString commandUnchangable = "UNCHANGEABLE"; static const QString commandUpdateFilesClient = "update"; class Tools { diff --git a/ServerLMS/Systems/updatecontroller.cpp b/ServerLMS/Systems/updatecontroller.cpp index 08c7e9c..2b66318 100644 --- a/ServerLMS/Systems/updatecontroller.cpp +++ b/ServerLMS/Systems/updatecontroller.cpp @@ -431,6 +431,15 @@ void UpdateController::calculateSharedHash() fileInfo.absoluteFilePath(),fileInfo.fileName(), fileInfo.birthTime(),fileInfo.size()); + if(fileInfo.fileName() == baseNameVersion) + { + version->setIsChangeable(false); + } + else + { + version->setIsChangeable(true); + } + versionList->append(version); } @@ -447,8 +456,9 @@ void UpdateController::createVersionListXmlAnswer(QList { SAttribute attribute1 = {"Version", ver->getViewName()}; SAttribute attribute2 = {"Created", ver->getCreateData().toString()}; + SAttribute attribute3 = {"isChangeable",QString::number(ver->getIsChangeable())}; - QList listAttr = {attribute1, attribute2}; + QList listAttr = {attribute1, attribute2,attribute3}; SXmlAnswerTag tag = {"VersionData", listAttr}; listTag.append(tag); @@ -492,6 +502,7 @@ void UpdateController::saveVersionToFile(StreamingVersionData *streamingVersion) xmlWriter.writeStartElement("VersionData"); xmlWriter.writeAttribute("Version",streamingVersion->getViewName()); xmlWriter.writeAttribute("Created",streamingVersion->getCreateData().toString()); + xmlWriter.writeAttribute("isChangeable",QString::number(streamingVersion->getIsChangeable())); xmlWriter.writeEndElement(); xmlWriter.writeEndDocument(); @@ -543,6 +554,11 @@ void UpdateController::xmlFileDataParse(QByteArray array) } } +StreamingVersionData* UpdateController::getCurrentVersion() +{ + return assetManager->getCurrentVersionData(); +} + void UpdateController::printFileList(QList fileData) { QListIterator iterator(fileData); diff --git a/ServerLMS/Systems/updatecontroller.h b/ServerLMS/Systems/updatecontroller.h index efe3aee..6932588 100644 --- a/ServerLMS/Systems/updatecontroller.h +++ b/ServerLMS/Systems/updatecontroller.h @@ -54,6 +54,7 @@ public: void createVersionListXmlAnswer(QList version); void saveVersionToFile(StreamingVersionData *streamingVersion); void xmlFileDataParse(QByteArray array); + StreamingVersionData *getCurrentVersion(); public slots: void changeAssetVersion(QString versionName); void createCopyVersion(QString versionName,QString newVersionName); diff --git a/ServerLMS/serverlmswidget.cpp b/ServerLMS/serverlmswidget.cpp index b90a0c3..4f8c27f 100644 --- a/ServerLMS/serverlmswidget.cpp +++ b/ServerLMS/serverlmswidget.cpp @@ -70,7 +70,7 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) : updateThread->start(); commonClientHandler->initialize(&clientsMap,processingSystem,dataParser,logger); - processingSystem->initialize(this,dataParser,commonClientHandler,logger); + processingSystem->initialize(this,dataParser,commonClientHandler,logger,updateController); logger->setTypeLog("widget");