/[LeafOK_CVS]/lbbs/src/section_list_display.c
ViewVC logotype

Diff of /lbbs/src/section_list_display.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.36 by sysadm, Mon Jun 23 13:14:15 2025 UTC Revision 1.37 by sysadm, Tue Jun 24 10:01:24 2025 UTC
# Line 22  Line 22 
22  #include "io.h"  #include "io.h"
23  #include "log.h"  #include "log.h"
24  #include "login.h"  #include "login.h"
25    #include "menu.h"
26  #include "section_list_display.h"  #include "section_list_display.h"
27  #include "section_list_loader.h"  #include "section_list_loader.h"
28  #include "screen.h"  #include "screen.h"
# Line 46  enum select_cmd_t Line 47  enum select_cmd_t
47          DELETE_ARTICLE = 7,          DELETE_ARTICLE = 7,
48          FIRST_TOPIC_ARTICLE = 8,          FIRST_TOPIC_ARTICLE = 8,
49          LAST_TOPIC_ARTICLE = 9,          LAST_TOPIC_ARTICLE = 9,
50            VIEW_EX_DIR = 10,
51  };  };
52    
53  static int section_list_draw_items(int page_id, ARTICLE *p_articles[], int article_count, int display_nickname, int ontop_start_offset)  static int section_list_draw_items(int page_id, ARTICLE *p_articles[], int article_count, int display_nickname, int ontop_start_offset)
# Line 174  static int section_list_draw_screen(cons Line 176  static int section_list_draw_screen(cons
176          moveto(2, 0);          moveto(2, 0);
177          prints("返回[\033[1;32m←\033[0;37m,\033[1;32mESC\033[0;37m] 选择[\033[1;32m↑\033[0;37m,\033[1;32m↓\033[0;37m] "          prints("返回[\033[1;32m←\033[0;37m,\033[1;32mESC\033[0;37m] 选择[\033[1;32m↑\033[0;37m,\033[1;32m↓\033[0;37m] "
178                     "阅读[\033[1;32m→\033[0;37m,\033[1;32mENTER\033[0;37m] 发表[\033[1;32mCtrl-P\033[0;37m] "                     "阅读[\033[1;32m→\033[0;37m,\033[1;32mENTER\033[0;37m] 发表[\033[1;32mCtrl-P\033[0;37m] "
179                     "%s[\033[1;32mn\033[0;37m] 帮助[\033[1;32mh\033[0;37m]\033[m",                     "%s[\033[1;32mn\033[0;37m] 精华区[\033[1;32mx\033[0;37m] 帮助[\033[1;32mh\033[0;37m]\033[m",
180                     (display_nickname ? "显示用户名" : "显示昵称"));                     (display_nickname ? "用户名" : "昵称"));
181          moveto(3, 0);          moveto(3, 0);
182          if (display_nickname)          if (display_nickname)
183          {          {
# Line 296  static enum select_cmd_t section_list_se Line 298  static enum select_cmd_t section_list_se
298                          return LAST_TOPIC_ARTICLE;                          return LAST_TOPIC_ARTICLE;
299                  case 'h':                  case 'h':
300                          return SHOW_HELP;                          return SHOW_HELP;
301                    case 'x':
302                            return VIEW_EX_DIR;
303                  default:                  default:
304                  }                  }
305    
# Line 801  int section_list_display(const char *sna Line 805  int section_list_display(const char *sna
805                                  return -2;                                  return -2;
806                          }                          }
807                          break;                          break;
808                    case VIEW_EX_DIR:
809                            if (section_list_ex_dir_display(p_section) < 0)
810                            {
811                                    log_error("section_list_ex_dir_display(sid=%d) error\n", p_section->sid);
812                            }
813                            if (section_list_draw_screen(sname, stitle, master_list, display_nickname) < 0)
814                            {
815                                    log_error("section_list_draw_screen() error\n");
816                                    return -2;
817                            }
818                            break;
819                  default:                  default:
820                          log_error("Unknown command %d\n", ret);                          log_error("Unknown command %d\n", ret);
821                  }                  }
# Line 808  int section_list_display(const char *sna Line 823  int section_list_display(const char *sna
823    
824          return 0;          return 0;
825  }  }
826    
827    int section_list_ex_dir_display(SECTION_LIST *p_section)
828    {
829            char str_section_name[LINE_BUFFER_LEN];
830            MENU_SET ex_menu_set;
831            int ch = 0;
832    
833            if (p_section == NULL)
834            {
835                    log_error("NULL pointer error\n");
836                    return -1;
837            }
838    
839            if (get_section_ex_menu_set(p_section, &ex_menu_set) < 0)
840            {
841                    log_error("get_section_ex_menu_set(sid=%d) error\n", p_section->sid);
842                    return -3;
843            }
844            if (get_menu_shm_readonly(&ex_menu_set) < 0)
845            {
846                    log_error("set_menu_shm_readonly(sid=%d) error\n", p_section->sid);
847                    return -3;
848            }
849    
850            snprintf(str_section_name, sizeof(str_section_name), "[%s | 精华区]", p_section->sname);
851    
852            clearscr();
853            show_bottom(str_section_name);
854    
855            if (display_menu(&ex_menu_set) == 0)
856            {
857                    while (!SYS_server_exit)
858                    {
859                            iflush();
860                            ch = igetch(100);
861                            switch (ch)
862                            {
863                            case KEY_NULL: // broken pipe
864                                    return 0;
865                            case KEY_TIMEOUT:
866                                    if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME)
867                                    {
868                                            return 0;
869                                    }
870                                    continue;
871                            case CR:
872                                    igetch_reset();
873                            default:
874                                    switch (menu_control(&ex_menu_set, ch))
875                                    {
876                                    case EXITMENU:
877                                            ch = EXITMENU;
878                                            break;
879                                    case REDRAW:
880                                            clearscr();
881                                            show_bottom(str_section_name);
882                                            display_menu(&ex_menu_set);
883                                            break;
884                                    case NOREDRAW:
885                                    case UNKNOWN_CMD:
886                                    default:
887                                            break;
888                                    }
889                            }
890    
891                            BBS_last_access_tm = time(NULL);
892    
893                            if (ch == EXITMENU)
894                            {
895                                    break;
896                            }
897                    }
898            }
899    
900            detach_menu_shm(&ex_menu_set);
901    
902            return 0;
903    }


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1