| 17 |
#include "section_list_display.h" |
#include "section_list_display.h" |
| 18 |
#include "section_list_loader.h" |
#include "section_list_loader.h" |
| 19 |
#include "article_cache.h" |
#include "article_cache.h" |
| 20 |
|
#include "article_post.h" |
| 21 |
#include "common.h" |
#include "common.h" |
| 22 |
#include "io.h" |
#include "io.h" |
| 23 |
#include "screen.h" |
#include "screen.h" |
| 40 |
CHANGE_PAGE = 2, |
CHANGE_PAGE = 2, |
| 41 |
REFRESH_SCREEN = 3, |
REFRESH_SCREEN = 3, |
| 42 |
CHANGE_NAME_DISPLAY = 4, |
CHANGE_NAME_DISPLAY = 4, |
| 43 |
|
POST_ARTICLE = 5, |
| 44 |
|
EDIT_ARTICLE = 6, |
| 45 |
}; |
}; |
| 46 |
|
|
| 47 |
static int section_list_draw_items(int page_id, ARTICLE *p_articles[], int article_count, int display_nickname) |
static int section_list_draw_items(int page_id, ARTICLE *p_articles[], int article_count, int display_nickname) |
| 196 |
return VIEW_ARTICLE; |
return VIEW_ARTICLE; |
| 197 |
} |
} |
| 198 |
break; |
break; |
| 199 |
|
case Ctrl('P'): |
| 200 |
|
return POST_ARTICLE; |
| 201 |
|
case 'E': |
| 202 |
|
return EDIT_ARTICLE; |
| 203 |
case KEY_HOME: |
case KEY_HOME: |
| 204 |
*p_page_id = 0; |
*p_page_id = 0; |
| 205 |
case KEY_PGUP: |
case KEY_PGUP: |
| 296 |
} |
} |
| 297 |
*p_key = 0; |
*p_key = 0; |
| 298 |
break; |
break; |
| 299 |
|
case 'r': // Reply article |
| 300 |
|
return 1; |
| 301 |
case KEY_UP: |
case KEY_UP: |
| 302 |
case KEY_PGUP: |
case KEY_PGUP: |
| 303 |
case KEY_HOME: |
case KEY_HOME: |
| 443 |
break; |
break; |
| 444 |
} |
} |
| 445 |
|
|
| 446 |
ret = display_data(cache.p_data, cache.line_total, cache.line_offsets, 1, 0, |
ret = display_data(cache.p_data, cache.line_total, cache.line_offsets, 0, |
| 447 |
display_article_key_handler, DATA_READ_HELP); |
display_article_key_handler, DATA_READ_HELP); |
| 448 |
|
|
| 449 |
if (article_cache_unload(&cache) < 0) |
if (article_cache_unload(&cache) < 0) |
| 543 |
loop = 1; |
loop = 1; |
| 544 |
} |
} |
| 545 |
break; |
break; |
| 546 |
|
case 'r': // Reply article |
| 547 |
|
if (article_post(p_section, p_articles[selected_index], ARTICLE_POST_REPLY) < 0) |
| 548 |
|
{ |
| 549 |
|
log_error("article_post(aid=%d, REPLY) error\n", p_articles[selected_index]->aid); |
| 550 |
|
} |
| 551 |
|
loop = 1; |
| 552 |
|
break; |
| 553 |
} |
} |
| 554 |
} while (loop); |
} while (loop); |
| 555 |
|
|
| 567 |
if (section_list_draw_screen(sname, stitle, master_list, display_nickname) < 0) |
if (section_list_draw_screen(sname, stitle, master_list, display_nickname) < 0) |
| 568 |
{ |
{ |
| 569 |
log_error("section_list_draw_screen() error\n"); |
log_error("section_list_draw_screen() error\n"); |
| 570 |
|
return -2; |
| 571 |
|
} |
| 572 |
|
break; |
| 573 |
|
case POST_ARTICLE: |
| 574 |
|
if (article_post(p_section, NULL, ARTICLE_POST_NEW) < 0) |
| 575 |
|
{ |
| 576 |
|
log_error("article_post(sid=%d, NEW) error\n", p_section->sid); |
| 577 |
|
} |
| 578 |
|
if (section_list_draw_screen(sname, stitle, master_list, display_nickname) < 0) |
| 579 |
|
{ |
| 580 |
|
log_error("section_list_draw_screen() error\n"); |
| 581 |
|
return -2; |
| 582 |
|
} |
| 583 |
|
break; |
| 584 |
|
case EDIT_ARTICLE: |
| 585 |
|
if (p_articles[selected_index]->uid != BBS_priv.uid) |
| 586 |
|
{ |
| 587 |
|
break; |
| 588 |
|
} |
| 589 |
|
if (article_post(p_section, p_articles[selected_index], ARTICLE_POST_EDIT) < 0) |
| 590 |
|
{ |
| 591 |
|
log_error("article_post(aid=%d, EDIT) error\n", p_articles[selected_index]->aid); |
| 592 |
|
} |
| 593 |
|
if (section_list_draw_screen(sname, stitle, master_list, display_nickname) < 0) |
| 594 |
|
{ |
| 595 |
|
log_error("section_list_draw_screen() error\n"); |
| 596 |
return -2; |
return -2; |
| 597 |
} |
} |
| 598 |
break; |
break; |