use of com.cas.sim.tis.view.control.IPublish in project TeachingInSimulation by ScOrPiOzzy.
the class PreviewQuestionPaper method publish.
@FXML
private void publish() {
// 判断当前是否有考核正在进行
if (Session.get(Session.KEY_LIBRARY_PUBLISH_ID) != null) {
AlertUtil.showAlert(AlertType.WARNING, MsgUtil.getMessage("alert.warning.examing"));
return;
}
// 创建考核记录
List<Class> classes = SpringUtil.getBean(ClassAction.class).findClassesByTeacher(Session.get(Session.KEY_LOGIN_ID));
Dialog<Integer> dialog = new Dialog<>();
dialog.setDialogPane(new ClassSelectDialog(classes));
dialog.setTitle(MsgUtil.getMessage("class.dialog.select"));
dialog.setPrefSize(652, 420);
dialog.showAndWait().ifPresent(cid -> {
if (cid == null) {
return;
}
try {
Integer publishId = SpringUtil.getBean(LibraryPublishAction.class).publishLibraryToClass(rid, cid);
// 记录当前考核发布编号
Session.set(Session.KEY_LIBRARY_PUBLISH_ID, publishId);
// 添加考核进行时菜单
PageController controller = SpringUtil.getBean(PageController.class);
ILeftContent content = controller.getLeftMenu();
if (content instanceof IPublish) {
((IPublish) content).publish(publishId);
}
} catch (Exception e) {
e.printStackTrace();
AlertUtil.showAlert(AlertType.ERROR, e.getMessage());
}
});
}
Aggregations