mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Откл-е запр-в на EditorTrainees EditorInstructors
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
ViewerInstructors::ViewerInstructors(ConnectorToServer* connectorToServer, QWidget *parent) :
|
||||
InstructorsView(connectorToServer, CommonView::TypeView::onlyView, parent),
|
||||
dlgRedactor(nullptr),
|
||||
flTryEditorInstructors(false),
|
||||
ui(new Ui::ViewerInstructors)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@@ -20,6 +21,8 @@ ViewerInstructors::ViewerInstructors(ConnectorToServer* connectorToServer, QWidg
|
||||
setNotLoggedInVisible(true);
|
||||
|
||||
ui->btnEditorInstructors->setVisible(false);
|
||||
|
||||
connect(connectorToServer, &ConnectorToServer::sigTryBlockResult, this, &ViewerInstructors::slot_checkTryBlockResult);
|
||||
}
|
||||
|
||||
ViewerInstructors::~ViewerInstructors()
|
||||
@@ -48,6 +51,8 @@ void ViewerInstructors::deactivate()
|
||||
dlgRedactor = nullptr;
|
||||
}
|
||||
|
||||
flTryEditorInstructors = false;
|
||||
|
||||
CommonView::deactivate();
|
||||
updateButtons();
|
||||
}
|
||||
@@ -75,23 +80,31 @@ void ViewerInstructors::slot_receiveMessage(ClientMessage clientMessage)
|
||||
slot_NeedUpdateUI(true, false);
|
||||
}
|
||||
|
||||
void ViewerInstructors::slot_checkTryBlockResult(bool result, QString type)
|
||||
{
|
||||
if(flTryEditorInstructors)
|
||||
{
|
||||
if(type == "EditorInstructors")
|
||||
{
|
||||
if(result)
|
||||
{//Одобрено
|
||||
dialog_EditorInstructors();
|
||||
}
|
||||
else
|
||||
{//Отказ
|
||||
SpecMsgBox::WarningClose(this, tr("The server rejected your request to access instructors control.\nAnother instructor is managing instructors.\nPlease try again later."));
|
||||
}
|
||||
|
||||
flTryEditorInstructors = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerInstructors::on_btnEditorInstructors_clicked()
|
||||
{
|
||||
flTryEditorInstructors = true;
|
||||
|
||||
connectorToServer->sendQueryBlockAuth(true, "EditorInstructors");
|
||||
|
||||
dlgRedactor = new DialogRedactorInstructors(connectorToServer, adminMode, this);
|
||||
dlgRedactor->exec();
|
||||
|
||||
if(dlgRedactor)
|
||||
{
|
||||
delete dlgRedactor;
|
||||
dlgRedactor = nullptr;
|
||||
}
|
||||
|
||||
if(authComplited)
|
||||
loadInstructorsFromDB();
|
||||
|
||||
connectorToServer->sendQueryBlockAuth(false, "EditorInstructors");
|
||||
}
|
||||
|
||||
void ViewerInstructors::on_treeWidgetCurrentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
||||
@@ -143,3 +156,20 @@ void ViewerInstructors::updateButtons()
|
||||
ui->btnEditorInstructors->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerInstructors::dialog_EditorInstructors()
|
||||
{
|
||||
dlgRedactor = new DialogRedactorInstructors(connectorToServer, adminMode, this);
|
||||
dlgRedactor->exec();
|
||||
|
||||
if(dlgRedactor)
|
||||
{
|
||||
delete dlgRedactor;
|
||||
dlgRedactor = nullptr;
|
||||
}
|
||||
|
||||
if(authComplited)
|
||||
loadInstructorsFromDB();
|
||||
|
||||
connectorToServer->sendQueryBlockAuth(false, "EditorInstructors");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user