mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
DocsUpdater 1rev
This commit is contained in:
@@ -56,6 +56,7 @@ kanban-plugin: board
|
|||||||
(Так как сейчас может вызвать проблемы при смене логина юзера!!!)
|
(Так как сейчас может вызвать проблемы при смене логина юзера!!!)
|
||||||
- [ ] Зарефакторить databaselms_PostgreSQL.cpp
|
- [ ] Зарефакторить databaselms_PostgreSQL.cpp
|
||||||
(возможно, нужно использовать транзакции при восстановлении БД!)
|
(возможно, нужно использовать транзакции при восстановлении БД!)
|
||||||
|
- [ ] При долгой работе загибается главное окно (предположительно из-за лога)
|
||||||
|
|
||||||
|
|
||||||
## GUI Messenger
|
## GUI Messenger
|
||||||
|
|||||||
@@ -52,7 +52,13 @@ bool Module::getIsActive()
|
|||||||
return this->isActive;
|
return this->isActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Module::setModeList(ModeList modeList)
|
||||||
|
{
|
||||||
|
this->modeList = modeList;
|
||||||
|
|
||||||
|
if(modeList.demo || modeList.train || modeList.exam || modeList.autoM)
|
||||||
|
setIsActiveTrue();
|
||||||
|
}
|
||||||
|
|
||||||
PM::PM():
|
PM::PM():
|
||||||
modelIdentCode (),
|
modelIdentCode (),
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#define MODULE_H
|
#define MODULE_H
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include "instructorsAndTrainees_global.h"
|
||||||
|
|
||||||
enum ModuleType
|
enum ModuleType
|
||||||
{
|
{
|
||||||
@@ -9,7 +10,15 @@ enum ModuleType
|
|||||||
TYPE_DM = 1
|
TYPE_DM = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
class Module
|
struct ModeList
|
||||||
|
{
|
||||||
|
bool demo = false;
|
||||||
|
bool train = false;
|
||||||
|
bool exam = false;
|
||||||
|
bool autoM = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
class INSTRUCTORSANDTRAINEES_EXPORT Module
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Module();
|
Module();
|
||||||
@@ -20,19 +29,26 @@ public:
|
|||||||
void setParentModule(Module* parentModule){ this->parentModule = parentModule; };
|
void setParentModule(Module* parentModule){ this->parentModule = parentModule; };
|
||||||
Module* getModuleByID(int id);
|
Module* getModuleByID(int id);
|
||||||
|
|
||||||
void setIsActiveTrue();
|
|
||||||
bool getIsActive();
|
bool getIsActive();
|
||||||
|
|
||||||
|
void setModeList(ModeList modeList);;
|
||||||
|
ModeList getModeList(){return modeList;};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void setIsActiveTrue();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ModuleType type;
|
ModuleType type;
|
||||||
Module* parentModule;
|
Module* parentModule;
|
||||||
int ID;
|
int ID;
|
||||||
static int lastID;
|
static int lastID;
|
||||||
bool isActive;
|
bool isActive;
|
||||||
|
|
||||||
|
ModeList modeList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class PM : public Module
|
class INSTRUCTORSANDTRAINEES_EXPORT PM : public Module
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct pmLangStruct
|
struct pmLangStruct
|
||||||
@@ -66,7 +82,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class DM : public Module
|
class INSTRUCTORSANDTRAINEES_EXPORT DM : public Module
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct dmLangStruct
|
struct dmLangStruct
|
||||||
|
|||||||
@@ -356,8 +356,9 @@ void TaskAMMFIMTreePreparation::domElementParserAMM(QDomElement element, Module*
|
|||||||
|
|
||||||
//Активность
|
//Активность
|
||||||
QString canplay = nodeMap.namedItem("canplay").nodeValue();
|
QString canplay = nodeMap.namedItem("canplay").nodeValue();
|
||||||
if(canplay.contains("+"))
|
DMmodulParent->setModeList(parseCanplay(canplay));
|
||||||
DMmodulParent->setIsActiveTrue();
|
//if(canplay.contains("+"))
|
||||||
|
//DMmodulParent->setIsActiveTrue();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
DMmodulParent->setLangStructEng(nodeMap.namedItem("techName").nodeValue(),
|
DMmodulParent->setLangStructEng(nodeMap.namedItem("techName").nodeValue(),
|
||||||
@@ -391,6 +392,45 @@ void TaskAMMFIMTreePreparation::domElementParserAMM(QDomElement element, Module*
|
|||||||
}while (! (childElement = childElement.nextSiblingElement()).isNull());
|
}while (! (childElement = childElement.nextSiblingElement()).isNull());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ModeList TaskAMMFIMTreePreparation::parseCanplay(QString canplay)
|
||||||
|
{
|
||||||
|
ModeList modeList;
|
||||||
|
|
||||||
|
if(canplay == "")
|
||||||
|
{
|
||||||
|
modeList.demo = false;
|
||||||
|
modeList.train = false;
|
||||||
|
modeList.exam = false;
|
||||||
|
modeList.autoM = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QStringList list = canplay.split("/");
|
||||||
|
|
||||||
|
if(list.at(0) == "+")
|
||||||
|
modeList.demo = true;
|
||||||
|
else
|
||||||
|
modeList.demo = false;
|
||||||
|
|
||||||
|
if(list.at(1) == "+")
|
||||||
|
modeList.train = true;
|
||||||
|
else
|
||||||
|
modeList.train = false;
|
||||||
|
|
||||||
|
if(list.at(2) == "+")
|
||||||
|
modeList.exam = true;
|
||||||
|
else
|
||||||
|
modeList.exam = false;
|
||||||
|
|
||||||
|
if(list.at(3) == "+")
|
||||||
|
modeList.autoM = true;
|
||||||
|
else
|
||||||
|
modeList.autoM = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return modeList;
|
||||||
|
}
|
||||||
|
|
||||||
void TaskAMMFIMTreePreparation::slot_prepareAMMListItems(QByteArray array, bool flOnlyActive, bool flRequestFirst)
|
void TaskAMMFIMTreePreparation::slot_prepareAMMListItems(QByteArray array, bool flOnlyActive, bool flRequestFirst)
|
||||||
{
|
{
|
||||||
qDebug() << "TaskAMMFIMTreePreparation::slot_prepareAMMListItems thread ID " << QThread::currentThreadId();
|
qDebug() << "TaskAMMFIMTreePreparation::slot_prepareAMMListItems thread ID " << QThread::currentThreadId();
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ private:
|
|||||||
void loadAMMtasksFromXML(QByteArray array);
|
void loadAMMtasksFromXML(QByteArray array);
|
||||||
void domElementParserAMM(QDomElement element, Module* moduleParent);
|
void domElementParserAMM(QDomElement element, Module* moduleParent);
|
||||||
void deleteAllModulsAMM();
|
void deleteAllModulsAMM();
|
||||||
|
ModeList parseCanplay(QString canplay);
|
||||||
|
|
||||||
void loadFIMtasksFromXML(QByteArray array);
|
void loadFIMtasksFromXML(QByteArray array);
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ add_library(ServerLMS SHARED
|
|||||||
Systems/chatsystem.h
|
Systems/chatsystem.h
|
||||||
Systems/fasthashcalculator.cpp
|
Systems/fasthashcalculator.cpp
|
||||||
Systems/fasthashcalculator.h
|
Systems/fasthashcalculator.h
|
||||||
|
Systems/docsupdater.cpp
|
||||||
|
Systems/docsupdater.h
|
||||||
providerdblms/providerdblms.cpp
|
providerdblms/providerdblms.cpp
|
||||||
providerdblms/providerdblms.h
|
providerdblms/providerdblms.h
|
||||||
ServerLMS.qrc
|
ServerLMS.qrc
|
||||||
@@ -78,6 +80,7 @@ target_link_libraries(ServerLMS PRIVATE libDataBaseLMS.dll)
|
|||||||
|
|
||||||
target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees)
|
target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees)
|
||||||
target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/authorization)
|
target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/authorization)
|
||||||
|
target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/tasks)
|
||||||
if(PROJECT_TYPE_DEBUG)
|
if(PROJECT_TYPE_DEBUG)
|
||||||
target_link_directories(ServerLMS PUBLIC ${REPO_PATH}/BUILDS/Debug64/InstructorsAndTrainees)
|
target_link_directories(ServerLMS PUBLIC ${REPO_PATH}/BUILDS/Debug64/InstructorsAndTrainees)
|
||||||
else()
|
else()
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ QByteArray DataParser::xmlAnswer(QList<SXmlAnswerTag> listTag, QString elemUp1,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataParser::loadBlankXML(QString nameFile, QDomDocument *commonDOM)
|
bool DataParser::loadXMLtoDOM(QString nameFile, QDomDocument *commonDOM)
|
||||||
{
|
{
|
||||||
QFile blankFile(nameFile);
|
QFile blankFile(nameFile);
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ public:
|
|||||||
|
|
||||||
QByteArray xmlAnswer(QList<SXmlAnswerTag> listTag,QString elemUp1 = "", QString elemUp2 = "");
|
QByteArray xmlAnswer(QList<SXmlAnswerTag> listTag,QString elemUp1 = "", QString elemUp2 = "");
|
||||||
|
|
||||||
bool loadBlankXML(QString nameFile, QDomDocument* commonDOM);
|
static bool loadXMLtoDOM(QString nameFile, QDomDocument* commonDOM);
|
||||||
bool saveDOMtoXML(QString nameFile, QDomDocument* commonDOM);
|
static bool saveDOMtoXML(QString nameFile, QDomDocument* commonDOM);
|
||||||
~DataParser();
|
~DataParser();
|
||||||
|
|
||||||
ClientAnswerParser *ClientAnswer() const;
|
ClientAnswerParser *ClientAnswer() const;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ void DBAnswerParser::initialize(DataParser *dataParser)
|
|||||||
QByteArray DBAnswerParser::listInstructors(bool result, QList<Instructor> *listInstructors)
|
QByteArray DBAnswerParser::listInstructors(bool result, QList<Instructor> *listInstructors)
|
||||||
{
|
{
|
||||||
QDomDocument commonDOM;
|
QDomDocument commonDOM;
|
||||||
if(! dataParser->loadBlankXML(":/resources/blankXML/ListInstructors.xml", &commonDOM))
|
if(! dataParser->loadXMLtoDOM(":/resources/blankXML/ListInstructors.xml", &commonDOM))
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
|
||||||
QDomNode listNode = commonDOM.namedItem("ListInstructors");
|
QDomNode listNode = commonDOM.namedItem("ListInstructors");
|
||||||
@@ -42,7 +42,7 @@ QByteArray DBAnswerParser::listInstructors(bool result, QList<Instructor> *listI
|
|||||||
QByteArray DBAnswerParser::listGroups(bool result, QList<Group> *listGroups)
|
QByteArray DBAnswerParser::listGroups(bool result, QList<Group> *listGroups)
|
||||||
{
|
{
|
||||||
QDomDocument commonDOM;
|
QDomDocument commonDOM;
|
||||||
if(! dataParser->loadBlankXML(":/resources/blankXML/ListGroups.xml", &commonDOM))
|
if(! dataParser->loadXMLtoDOM(":/resources/blankXML/ListGroups.xml", &commonDOM))
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
|
||||||
QDomNode listNode = commonDOM.namedItem("ListGroups");
|
QDomNode listNode = commonDOM.namedItem("ListGroups");
|
||||||
@@ -64,7 +64,7 @@ QByteArray DBAnswerParser::listGroups(bool result, QList<Group> *listGroups)
|
|||||||
QByteArray DBAnswerParser::listTrainees(bool result, QList<Trainee> *listTrainees)
|
QByteArray DBAnswerParser::listTrainees(bool result, QList<Trainee> *listTrainees)
|
||||||
{
|
{
|
||||||
QDomDocument commonDOM;
|
QDomDocument commonDOM;
|
||||||
if(! dataParser->loadBlankXML(":/resources/blankXML/ListTrainees.xml", &commonDOM))
|
if(! dataParser->loadXMLtoDOM(":/resources/blankXML/ListTrainees.xml", &commonDOM))
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
|
||||||
QDomNode listNode = commonDOM.namedItem("ListTrainees");
|
QDomNode listNode = commonDOM.namedItem("ListTrainees");
|
||||||
@@ -142,7 +142,7 @@ QByteArray DBAnswerParser::listContacts(bool result, QList<ContactModel> *listCo
|
|||||||
QByteArray DBAnswerParser::listTasksAMMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list)
|
QByteArray DBAnswerParser::listTasksAMMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list)
|
||||||
{
|
{
|
||||||
QDomDocument commonDOM;
|
QDomDocument commonDOM;
|
||||||
if(! dataParser->loadBlankXML(":/resources/blankXML/ListTasksAMM.xml", &commonDOM))
|
if(! dataParser->loadXMLtoDOM(":/resources/blankXML/ListTasksAMM.xml", &commonDOM))
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
|
||||||
QDomNode listNode = commonDOM.namedItem("ListTasksAMM");
|
QDomNode listNode = commonDOM.namedItem("ListTasksAMM");
|
||||||
@@ -171,7 +171,7 @@ QByteArray DBAnswerParser::listTasksAMMofTrainee(bool result, QList<TaskAmmFim>
|
|||||||
QByteArray DBAnswerParser::listTasksFIMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list)
|
QByteArray DBAnswerParser::listTasksFIMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list)
|
||||||
{
|
{
|
||||||
QDomDocument commonDOM;
|
QDomDocument commonDOM;
|
||||||
if(! dataParser->loadBlankXML(":/resources/blankXML/ListTasksFIM.xml", &commonDOM))
|
if(! dataParser->loadXMLtoDOM(":/resources/blankXML/ListTasksFIM.xml", &commonDOM))
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
|
||||||
QDomNode listNode = commonDOM.namedItem("ListTasksFIM");
|
QDomNode listNode = commonDOM.namedItem("ListTasksFIM");
|
||||||
|
|||||||
270
ServerLMS/Systems/docsupdater.cpp
Normal file
270
ServerLMS/Systems/docsupdater.cpp
Normal file
@@ -0,0 +1,270 @@
|
|||||||
|
#include <QString>
|
||||||
|
#include "docsupdater.h"
|
||||||
|
#include "tools.h"
|
||||||
|
|
||||||
|
|
||||||
|
DocsUpdater::DocsUpdater(UpdateController* updateController):
|
||||||
|
updateController(updateController),
|
||||||
|
flagStop(false)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DocsUpdater::update()
|
||||||
|
{
|
||||||
|
QString nameDocsFile = tasksAMMfileName;
|
||||||
|
QString pathDocsFile = updateController->getPathAdditionalFile(nameDocsFile);
|
||||||
|
|
||||||
|
QDomDocument docTasksDOM;
|
||||||
|
if(! DataParser::loadXMLtoDOM(pathDocsFile, &docTasksDOM))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
QDomElement manifestElement = docTasksDOM.firstChildElement("manifest");
|
||||||
|
if(manifestElement.isNull())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
deleteAllModulsAMM();
|
||||||
|
listTasksAMM.clear();
|
||||||
|
|
||||||
|
domElementParserAMM(manifestElement, nullptr);
|
||||||
|
|
||||||
|
if(! DataParser::saveDOMtoXML(pathDocsFile, &docTasksDOM))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DocsUpdater::domElementParserAMM(QDomElement element, Module* moduleParent)
|
||||||
|
{
|
||||||
|
QString name;
|
||||||
|
|
||||||
|
if(flagStop)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QDomElement childElement = element.firstChildElement();
|
||||||
|
if(childElement.isNull())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Module* module = nullptr;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
name = childElement.nodeName();
|
||||||
|
|
||||||
|
QDomNamedNodeMap nodeMap = childElement.attributes();
|
||||||
|
|
||||||
|
if(name == "doc")
|
||||||
|
{
|
||||||
|
module = new PM();
|
||||||
|
}
|
||||||
|
else if(name == "pm")
|
||||||
|
{
|
||||||
|
module = new PM();
|
||||||
|
PM* PMmodul = static_cast<PM*>(module);
|
||||||
|
|
||||||
|
PMmodul->initialize(nodeMap.namedItem("modelIdentCode").nodeValue(),
|
||||||
|
nodeMap.namedItem("pmIssuer").nodeValue(),
|
||||||
|
nodeMap.namedItem("pmNumber").nodeValue(),
|
||||||
|
nodeMap.namedItem("pmVolume").nodeValue());
|
||||||
|
|
||||||
|
if(moduleParent)
|
||||||
|
{
|
||||||
|
PMmodul->setParentModule(moduleParent);
|
||||||
|
|
||||||
|
PM* PMmodulParent = static_cast<PM*>(moduleParent);
|
||||||
|
PMmodulParent->addChildModule(module);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(name == "dm")
|
||||||
|
{
|
||||||
|
module = new DM();
|
||||||
|
DM* DMmodul = static_cast<DM*>(module);
|
||||||
|
|
||||||
|
DMmodul->initialize(nodeMap.namedItem("modelIdentCode").nodeValue(),
|
||||||
|
nodeMap.namedItem("systemDiffCode").nodeValue(),
|
||||||
|
nodeMap.namedItem("systemCode").nodeValue(),
|
||||||
|
nodeMap.namedItem("subSystemCode").nodeValue(),
|
||||||
|
nodeMap.namedItem("subSubSystemCode").nodeValue(),
|
||||||
|
nodeMap.namedItem("assyCode").nodeValue(),
|
||||||
|
nodeMap.namedItem("disassyCode").nodeValue(),
|
||||||
|
nodeMap.namedItem("disassyCodeVariant").nodeValue(),
|
||||||
|
nodeMap.namedItem("infoCode").nodeValue(),
|
||||||
|
nodeMap.namedItem("infoCodeVariant").nodeValue(),
|
||||||
|
nodeMap.namedItem("itemLocationCode").nodeValue());
|
||||||
|
|
||||||
|
if(moduleParent)
|
||||||
|
{
|
||||||
|
DMmodul->setParentModule(moduleParent);
|
||||||
|
|
||||||
|
PM* PMmodulParent = static_cast<PM*>(moduleParent);
|
||||||
|
PMmodulParent->addChildModule(module);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(name == "rus" || name == "eng")
|
||||||
|
{
|
||||||
|
if(moduleParent)
|
||||||
|
{
|
||||||
|
if(moduleParent->getType() == ModuleType::TYPE_PM)
|
||||||
|
{//PM
|
||||||
|
PM* PMmodulParent = static_cast<PM*>(moduleParent);
|
||||||
|
|
||||||
|
if(name == "rus")
|
||||||
|
PMmodulParent->setLangStructRus(nodeMap.namedItem("title").nodeValue());
|
||||||
|
else
|
||||||
|
PMmodulParent->setLangStructEng(nodeMap.namedItem("title").nodeValue());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//DM
|
||||||
|
DM* DMmodulParent = static_cast<DM*>(moduleParent);
|
||||||
|
|
||||||
|
if(name == "rus")
|
||||||
|
{
|
||||||
|
DMmodulParent->setLangStructRus(nodeMap.namedItem("techName").nodeValue(),
|
||||||
|
nodeMap.namedItem("infoName").nodeValue(),
|
||||||
|
nodeMap.namedItem("pdf").nodeValue(),
|
||||||
|
nodeMap.namedItem("bookmark").nodeValue(),
|
||||||
|
nodeMap.namedItem("xml").nodeValue());
|
||||||
|
|
||||||
|
//Активность
|
||||||
|
//QString canplay = nodeMap.namedItem("canplay").nodeValue();
|
||||||
|
|
||||||
|
//Обновление Активности
|
||||||
|
QString dmCode = DMmodulParent->dmCode();
|
||||||
|
QString canplay = defineCanplayByScenXML(dmCode);
|
||||||
|
DMmodulParent->setModeList(parseCanplay(canplay));
|
||||||
|
nodeMap.namedItem("canplay").setNodeValue(canplay);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
DMmodulParent->setLangStructEng(nodeMap.namedItem("techName").nodeValue(),
|
||||||
|
nodeMap.namedItem("infoName").nodeValue(),
|
||||||
|
nodeMap.namedItem("pdf").nodeValue(),
|
||||||
|
nodeMap.namedItem("bookmark").nodeValue(),
|
||||||
|
nodeMap.namedItem("xml").nodeValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
domElementParserAMM(childElement, module);
|
||||||
|
|
||||||
|
if(moduleParent == nullptr)
|
||||||
|
listAllModulesAMM.append(module);
|
||||||
|
|
||||||
|
if(module)
|
||||||
|
if(module->getType() == ModuleType::TYPE_DM)
|
||||||
|
{
|
||||||
|
TaskAmmFim* task = nullptr;
|
||||||
|
task = new TaskAmmFim();
|
||||||
|
task->setID(module->getID());
|
||||||
|
task->ammProcedure.title = static_cast<DM*>(module)->getLangStructRus().techName;
|
||||||
|
task->ammProcedure.dmCode = static_cast<DM*>(module)->dmCode();
|
||||||
|
|
||||||
|
listTasksAMM.append(*task);
|
||||||
|
delete task;
|
||||||
|
}
|
||||||
|
|
||||||
|
}while (! (childElement = childElement.nextSiblingElement()).isNull());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DocsUpdater::deleteAllModulsAMM()
|
||||||
|
{
|
||||||
|
for(Module* module: listAllModulesAMM)
|
||||||
|
{
|
||||||
|
if(module->getType() == ModuleType::TYPE_PM)
|
||||||
|
delete static_cast<PM*>(module);
|
||||||
|
else
|
||||||
|
delete static_cast<DM*>(module);
|
||||||
|
}
|
||||||
|
listAllModulesAMM.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
ModeList DocsUpdater::parseCanplay(QString canplay)
|
||||||
|
{
|
||||||
|
ModeList modeList;
|
||||||
|
|
||||||
|
if(canplay == "")
|
||||||
|
{
|
||||||
|
modeList.demo = false;
|
||||||
|
modeList.train = false;
|
||||||
|
modeList.exam = false;
|
||||||
|
modeList.autoM = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QStringList list = canplay.split("/");
|
||||||
|
|
||||||
|
if(list.at(0) == "+")
|
||||||
|
modeList.demo = true;
|
||||||
|
else
|
||||||
|
modeList.demo = false;
|
||||||
|
|
||||||
|
if(list.at(1) == "+")
|
||||||
|
modeList.train = true;
|
||||||
|
else
|
||||||
|
modeList.train = false;
|
||||||
|
|
||||||
|
if(list.at(2) == "+")
|
||||||
|
modeList.exam = true;
|
||||||
|
else
|
||||||
|
modeList.exam = false;
|
||||||
|
|
||||||
|
if(list.at(3) == "+")
|
||||||
|
modeList.autoM = true;
|
||||||
|
else
|
||||||
|
modeList.autoM = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return modeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString DocsUpdater::defineCanplayByScenXML(QString dmCode)
|
||||||
|
{
|
||||||
|
QString canplay = "";
|
||||||
|
QString signDemo = "-";
|
||||||
|
QString signTrain = "-";
|
||||||
|
QString signExam = "-";
|
||||||
|
QString signAuto = "-";
|
||||||
|
|
||||||
|
QString nameScenXMLFile = dmCode + ".xml";
|
||||||
|
QString pathScenXMLFile = updateController->getPathScensFile(nameScenXMLFile);
|
||||||
|
|
||||||
|
QDomDocument docScenDOM;
|
||||||
|
if(! DataParser::loadXMLtoDOM(pathScenXMLFile, &docScenDOM))
|
||||||
|
return canplay;
|
||||||
|
|
||||||
|
QDomElement scenarioElement = docScenDOM.firstChildElement("scenario");
|
||||||
|
if(scenarioElement.isNull())
|
||||||
|
return canplay;
|
||||||
|
|
||||||
|
QDomElement demoElement = scenarioElement.firstChildElement("demo");
|
||||||
|
if(!demoElement.isNull())
|
||||||
|
{
|
||||||
|
if(demoElement.toElement().attribute("canplay") == "True")
|
||||||
|
signDemo = "+";
|
||||||
|
}
|
||||||
|
|
||||||
|
QDomElement trainElement = scenarioElement.firstChildElement("train");
|
||||||
|
if(!trainElement.isNull())
|
||||||
|
{
|
||||||
|
if(trainElement.toElement().attribute("canplay") == "True")
|
||||||
|
signTrain = "+";
|
||||||
|
}
|
||||||
|
|
||||||
|
QDomElement examElement = scenarioElement.firstChildElement("exam");
|
||||||
|
if(!examElement.isNull())
|
||||||
|
{
|
||||||
|
if(examElement.toElement().attribute("canplay") == "True")
|
||||||
|
signExam = "+";
|
||||||
|
}
|
||||||
|
|
||||||
|
QDomElement autoElement = scenarioElement.firstChildElement("auto");
|
||||||
|
if(!autoElement.isNull())
|
||||||
|
{
|
||||||
|
if(autoElement.toElement().attribute("canplay") == "True")
|
||||||
|
signAuto = "+";
|
||||||
|
}
|
||||||
|
|
||||||
|
canplay = QString("%1/%2/%3/%4").arg(signDemo, signTrain, signExam, signAuto);
|
||||||
|
|
||||||
|
return canplay;
|
||||||
|
}
|
||||||
28
ServerLMS/Systems/docsupdater.h
Normal file
28
ServerLMS/Systems/docsupdater.h
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#ifndef DOCSUPDATER_H
|
||||||
|
#define DOCSUPDATER_H
|
||||||
|
|
||||||
|
#include "updatecontroller.h"
|
||||||
|
#include "module.h"
|
||||||
|
|
||||||
|
|
||||||
|
class DocsUpdater
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DocsUpdater(UpdateController* updateController);
|
||||||
|
|
||||||
|
bool update();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void domElementParserAMM(QDomElement element, Module* moduleParent);
|
||||||
|
void deleteAllModulsAMM();
|
||||||
|
ModeList parseCanplay(QString canplay);
|
||||||
|
QString defineCanplayByScenXML(QString dmCode);
|
||||||
|
|
||||||
|
private:
|
||||||
|
UpdateController* updateController;
|
||||||
|
bool flagStop;
|
||||||
|
QList<Module*> listAllModulesAMM; //?
|
||||||
|
QList<TaskAmmFim> listTasksAMM; //?
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DOCSUPDATER_H
|
||||||
@@ -17,6 +17,7 @@ static const QString applicationFolderName = "Application";
|
|||||||
static const QString sharedDataFolderName = "SharedData";
|
static const QString sharedDataFolderName = "SharedData";
|
||||||
static const QString projectFolderName = "RRJLoader";
|
static const QString projectFolderName = "RRJLoader";
|
||||||
static const QString additionalFilesFolderName = "RRJ-95NEW-100";
|
static const QString additionalFilesFolderName = "RRJ-95NEW-100";
|
||||||
|
static const QString rusScensFolderName = "RUS/Scens";
|
||||||
static const QString streamingAssetsFolderName = "StreamingAssets";
|
static const QString streamingAssetsFolderName = "StreamingAssets";
|
||||||
static const QString versionFolderName = "StreamingVersion";
|
static const QString versionFolderName = "StreamingVersion";
|
||||||
static const QString tempFile = staticDataFolderName + "/save.xml";
|
static const QString tempFile = staticDataFolderName + "/save.xml";
|
||||||
|
|||||||
@@ -406,6 +406,12 @@ QString UpdateController::getPathAdditionalFile(QString name)
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString UpdateController::getPathScensFile(QString name)
|
||||||
|
{
|
||||||
|
QString path = Tools::createSharedPath("/" + assetManager->getCurrentVersionData()->getViewName() + "/" + rusScensFolderName + name);
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray UpdateController::getLocalHash()
|
QByteArray UpdateController::getLocalHash()
|
||||||
{
|
{
|
||||||
QFile hashFile(hashFileName);
|
QFile hashFile(hashFileName);
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public:
|
|||||||
void xmlFileDataParse(QByteArray array);
|
void xmlFileDataParse(QByteArray array);
|
||||||
|
|
||||||
QString getPathAdditionalFile(QString name);
|
QString getPathAdditionalFile(QString name);
|
||||||
|
QString getPathScensFile(QString name);
|
||||||
|
|
||||||
StreamingVersionData *getCurrentVersion();
|
StreamingVersionData *getCurrentVersion();
|
||||||
void setDataInfo(DataInfo *value);
|
void setDataInfo(DataInfo *value);
|
||||||
|
|||||||
Reference in New Issue
Block a user