|
|
|
@ -262,19 +262,23 @@ def GetModuleButtons():
|
|
|
|
|
# Обработка кнопок |
|
|
|
|
def RegisterHandlers(dp : Dispatcher): |
|
|
|
|
defaul_keyboard_func = GetStartTaskKeyboardButtons |
|
|
|
|
def RegisterSelectParent(a_ButtonName, access_mode): |
|
|
|
|
a_PrefixBase = a_ButtonName |
|
|
|
|
return bd_item_select.FirstSelectBDItemRegisterHandlers(dp, a_PrefixBase, a_ButtonName, projects.table_name, projects.key_name, projects.GetButtonNameAndKeyValueAndAccess, projects.select_project_message, projects.GetAccess, access_mode = access_mode) |
|
|
|
|
|
|
|
|
|
# Стартовое сообщение |
|
|
|
|
dp.register_message_handler(simple_message.SimpleMessageTemplate(TasksOpen, defaul_keyboard_func, GetAccess), text = tasks_button_name) |
|
|
|
|
|
|
|
|
|
# Список задач |
|
|
|
|
a_Prefix, sel_handler = bd_item_select.FirstSelectBDItemRegisterHandlers(dp, 'view_task', list_task_button_name, projects.table_name, projects.key_name, projects.GetButtonNameAndKeyValueAndAccess, projects.select_project_message, projects.GetAccess, access_mode = user_access.AccessMode.VIEW) |
|
|
|
|
a_Prefix, sel_handler = RegisterSelectParent(list_task_button_name, user_access.AccessMode.VIEW) |
|
|
|
|
bd_item_view.LastSelectAndShowBDItemRegisterHandlers(dp, a_Prefix, parent_id_field, table_name, key_name, ShowMessageTemplate(task_open_message), GetButtonNameAndKeyValueAndAccess, select_task_message, GetAccess, defaul_keyboard_func, access_mode = user_access.AccessMode.VIEW) |
|
|
|
|
|
|
|
|
|
# Удаление задачи |
|
|
|
|
a_Prefix, sel_handler = bd_item_select.FirstSelectBDItemRegisterHandlers(dp, 'del_task', del_task_button_name, projects.table_name, projects.key_name, projects.GetButtonNameAndKeyValueAndAccess, projects.select_project_message, projects.GetAccess, access_mode = user_access.AccessMode.DELETE) |
|
|
|
|
a_Prefix, sel_handler = RegisterSelectParent(del_task_button_name, user_access.AccessMode.DELETE) |
|
|
|
|
bd_item_delete.DeleteBDItemRegisterHandlers(dp, a_Prefix, bd_item.GetCheckForPrefixFunc(a_Prefix), table_name, key_name, parent_id_field, TaskPreDelete, TaskPostDelete, GetButtonNameAndKeyValueAndAccess, select_task_message, GetAccess, defaul_keyboard_func) |
|
|
|
|
|
|
|
|
|
# Добавление задачи |
|
|
|
|
a_Prefix, sel_handler = bd_item_select.FirstSelectBDItemRegisterHandlers(dp, 'add_task', add_task_button_name, projects.table_name, projects.key_name, projects.GetButtonNameAndKeyValueAndAccess, projects.select_project_message, projects.GetAccess, access_mode = user_access.AccessMode.VIEW) |
|
|
|
|
a_Prefix, sel_handler = RegisterSelectParent(add_task_button_name, user_access.AccessMode.ADD) |
|
|
|
|
bd_item_add.AddBDItem3RegisterHandlers(dp, \ |
|
|
|
|
bd_item.GetCheckForPrefixFunc(a_Prefix), \ |
|
|
|
|
FSMCreateTask, \ |
|
|
|
@ -298,10 +302,14 @@ def RegisterHandlers(dp : Dispatcher):
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
# Редактирование задачи |
|
|
|
|
# edit_keyboard_func = GetEditTaskKeyboardButtons |
|
|
|
|
# dp.register_message_handler(simple_message.InfoMessageTemplate(task_start_edit_message, edit_keyboard_func, GetAccess, access_mode = user_access.AccessMode.EDIT), text = edit_task_button_name) |
|
|
|
|
# bd_item_edit.EditBDItemRegisterHandlers(dp, FSMEditPhotoItem, edit_task_photo_button_name, task_select_to_edit_message, ShowMessageTemplate(task_edit_photo_message), ShowMessageTemplate(task_success_edit_message), table_name, key_name, photo_field, GetButtonNameAndKeyValueAndAccess, GetAccess, edit_keyboard_func, access_mode = user_access.AccessMode.EDIT, field_type = bd_item.FieldType.photo) |
|
|
|
|
# bd_item_edit.EditBDItemRegisterHandlers(dp, FSMEditNameItem, edit_task_name_button_name, task_select_to_edit_message, ShowMessageTemplate(task_edit_name_message), ShowMessageTemplate(task_success_edit_message), table_name, key_name, name_field, GetButtonNameAndKeyValueAndAccess, GetAccess, edit_keyboard_func, access_mode = user_access.AccessMode.EDIT, field_type = bd_item.FieldType.text) |
|
|
|
|
# bd_item_edit.EditBDItemRegisterHandlers(dp, FSMEditDeskItem, edit_task_desc_button_name, task_select_to_edit_message, ShowMessageTemplate(task_edit_desc_message), ShowMessageTemplate(task_success_edit_message), table_name, key_name, desc_field, GetButtonNameAndKeyValueAndAccess, GetAccess, edit_keyboard_func, access_mode = user_access.AccessMode.EDIT, field_type = bd_item.FieldType.text) |
|
|
|
|
# bd_item_edit.EditBDItemRegisterHandlers(dp, FSMEditAccessItem, edit_task_access_button_name, task_select_to_edit_message, ShowMessageTemplate(task_edit_access_message), ShowMessageTemplate(task_success_edit_message), table_name, key_name, access_field, GetButtonNameAndKeyValueAndAccess, GetAccess, edit_keyboard_func, access_mode = user_access.AccessMode.ACCEES_EDIT, field_type = bd_item.FieldType.text) |
|
|
|
|
edit_keyboard_func = GetEditTaskKeyboardButtons |
|
|
|
|
dp.register_message_handler(simple_message.InfoMessageTemplate(task_start_edit_message, edit_keyboard_func, GetAccess, access_mode = user_access.AccessMode.EDIT), text = edit_task_button_name) |
|
|
|
|
a_Prefix, sel_handler = RegisterSelectParent(edit_task_photo_button_name, user_access.AccessMode.EDIT) |
|
|
|
|
bd_item_edit.EditBDItemRegisterHandlers(dp, a_Prefix, FSMEditPhotoItem, bd_item.GetCheckForPrefixFunc(a_Prefix), task_select_to_edit_message, ShowMessageTemplate(task_edit_photo_message), ShowMessageTemplate(task_success_edit_message), table_name, key_name, parent_id_field, photo_field, GetButtonNameAndKeyValueAndAccess, GetAccess, edit_keyboard_func, access_mode = user_access.AccessMode.EDIT, field_type = bd_item.FieldType.photo) |
|
|
|
|
a_Prefix, sel_handler = RegisterSelectParent(edit_task_name_button_name, user_access.AccessMode.EDIT) |
|
|
|
|
bd_item_edit.EditBDItemRegisterHandlers(dp, a_Prefix, FSMEditNameItem, bd_item.GetCheckForPrefixFunc(a_Prefix), task_select_to_edit_message, ShowMessageTemplate(task_edit_name_message), ShowMessageTemplate(task_success_edit_message), table_name, key_name, parent_id_field, name_field, GetButtonNameAndKeyValueAndAccess, GetAccess, edit_keyboard_func, access_mode = user_access.AccessMode.EDIT, field_type = bd_item.FieldType.text) |
|
|
|
|
a_Prefix, sel_handler = RegisterSelectParent(edit_task_desc_button_name, user_access.AccessMode.EDIT) |
|
|
|
|
bd_item_edit.EditBDItemRegisterHandlers(dp, a_Prefix, FSMEditDeskItem, bd_item.GetCheckForPrefixFunc(a_Prefix), task_select_to_edit_message, ShowMessageTemplate(task_edit_desc_message), ShowMessageTemplate(task_success_edit_message), table_name, key_name, parent_id_field, desc_field, GetButtonNameAndKeyValueAndAccess, GetAccess, edit_keyboard_func, access_mode = user_access.AccessMode.EDIT, field_type = bd_item.FieldType.text) |
|
|
|
|
a_Prefix, sel_handler = RegisterSelectParent(edit_task_access_button_name, user_access.AccessMode.EDIT) |
|
|
|
|
bd_item_edit.EditBDItemRegisterHandlers(dp, a_Prefix, FSMEditAccessItem, bd_item.GetCheckForPrefixFunc(a_Prefix), task_select_to_edit_message, ShowMessageTemplate(task_edit_access_message), ShowMessageTemplate(task_success_edit_message), table_name, key_name, parent_id_field, access_field, GetButtonNameAndKeyValueAndAccess, GetAccess, edit_keyboard_func, access_mode = user_access.AccessMode.ACCEES_EDIT, field_type = bd_item.FieldType.text) |
|
|
|
|
|
|
|
|
|