summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-12-24 23:18:15 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-12-24 23:18:15 +0800
commitebb38c5b0ea94a55365eac998433438f195f407e (patch)
treee6bbf8b87345aeef75f97d838f2d73bbe577a886
parentff7897f3bf68a25867e89114c44bbbe45d6e1231 (diff)
downloadpttbbs-ebb38c5b0ea94a55365eac998433438f195f407e.tar
pttbbs-ebb38c5b0ea94a55365eac998433438f195f407e.tar.gz
pttbbs-ebb38c5b0ea94a55365eac998433438f195f407e.tar.bz2
pttbbs-ebb38c5b0ea94a55365eac998433438f195f407e.tar.lz
pttbbs-ebb38c5b0ea94a55365eac998433438f195f407e.tar.xz
pttbbs-ebb38c5b0ea94a55365eac998433438f195f407e.tar.zst
pttbbs-ebb38c5b0ea94a55365eac998433438f195f407e.zip
- hide register menu option for registered users
- integrate calendar editing into calendar itself git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3736 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/calendar.c39
-rw-r--r--mbbsd/menu.c11
-rw-r--r--mbbsd/user.c30
3 files changed, 45 insertions, 35 deletions
diff --git a/mbbsd/calendar.c b/mbbsd/calendar.c
index 053474fe..2205d71b 100644
--- a/mbbsd/calendar.c
+++ b/mbbsd/calendar.c
@@ -270,6 +270,37 @@ GenerateCalendar(char **buf, int y, int m, int today, event_t * e)
}
int
+u_editcalendar(void)
+{
+ char genbuf[200];
+
+ getdata(b_lines - 1, 0, "行事曆 (D)刪除 (E)編輯 (H)說明 [Q]取消?[Q] ",
+ genbuf, 3, LCECHO);
+
+ if (genbuf[0] == 'e') {
+ int aborted;
+
+ setutmpmode(EDITPLAN);
+ sethomefile(genbuf, cuser.userid, "calendar");
+ aborted = vedit(genbuf, NA, NULL);
+ if (aborted != -1)
+ vmsg("行事曆更新完畢");
+ return 0;
+ } else if (genbuf[0] == 'd') {
+ sethomefile(genbuf, cuser.userid, "calendar");
+ unlink(genbuf);
+ vmsg("行事曆刪除完畢");
+ } else if (genbuf[0] == 'h') {
+ move(1, 0);
+ clrtoln(b_lines);
+ move(3, 0);
+ prints("行事曆格式說明:\n編輯時以一行為單位,如:\n\n# 井號開頭的是註解\n2006/05/04 red 上批踢踢!\n\n其中的 red 是指表示的顏色。");
+ pressanykey();
+ }
+ return 0;
+}
+
+int
calendar(void)
{
char **buf;
@@ -322,6 +353,12 @@ calendar(void)
}
FreeEvent(head);
FreeCalBuffer(buf);
- pressanykey();
+ i = vmsg("請按 e 編輯行事曆,或其它任意鍵離開。");
+ i = tolower(((unsigned char)i) & 0xFF);
+ if (i == 'e')
+ {
+ u_editcalendar();
+ }
return 0;
}
+
diff --git a/mbbsd/menu.c b/mbbsd/menu.c
index a16f88ae..8b11439d 100644
--- a/mbbsd/menu.c
+++ b/mbbsd/menu.c
@@ -1,7 +1,10 @@
/* $Id$ */
#include "bbs.h"
-#define CheckMenuPerm(x) ( (x) ? HasUserPerm(x) : 1)
+#define CheckMenuPerm(x) \
+ ( (x == MENU_UNREGONLY)? \
+ ((cuser.userlevel == 0 ||HasUserPerm(PERM_LOGINOK))?0:1) :\
+ ((x) ? HasUserPerm(x) : 1))
/* help & menu processring */
static int refscreen = NA;
@@ -457,7 +460,6 @@ static const commands_t userlist[] = {
{u_customize, PERM_LOGINOK, "UUCustomize 個人化設定"},
{u_info, PERM_LOGINOK, "IInfo 設定個人資料與密碼"},
{calendar, PERM_LOGINOK, "CCalendar 個人行事曆"},
- {u_editcalendar, PERM_LOGINOK, "CDEditCalendar 編輯個人行事曆"},
{u_loginview, PERM_LOGINOK, "LLogin View 選擇進站畫面"},
{u_editplan, PERM_LOGINOK, "QQueryEdit 編輯名片檔"},
{u_editsig, PERM_LOGINOK, "SSignature 編輯簽名檔"},
@@ -466,7 +468,7 @@ static const commands_t userlist[] = {
#else
{u_cloak, PERM_CLOAK, "KKCloak 隱身術"},
#endif
- {u_register, PERM_BASIC, "RRegister 填寫《註冊申請單》"},
+ {u_register, MENU_UNREGONLY, "RRegister 填寫《註冊申請單》"},
#ifdef ASSESS
{u_cancelbadpost, PERM_LOGINOK, "BBye BadPost 申請刪除劣文"},
#endif // ASSESS
@@ -677,7 +679,8 @@ Talk(void)
int
User(void)
{
- domenu(M_UMENU, "個人設定", 'U', userlist);
+ if (cuser.userlevel)
+ domenu(M_UMENU, "個人設定", 'U', userlist);
return 0;
}
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 1f66d8fc..513acccf 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -1319,36 +1319,6 @@ u_editplan(void)
return 0;
}
-int
-u_editcalendar(void)
-{
- char genbuf[200];
-
- getdata(b_lines - 1, 0, "行事曆 (D)刪除 (E)編輯 (H)說明 [Q]取消?[Q] ",
- genbuf, 3, LCECHO);
-
- if (genbuf[0] == 'e') {
- int aborted;
-
- setutmpmode(EDITPLAN);
- sethomefile(genbuf, cuser.userid, "calendar");
- aborted = vedit(genbuf, NA, NULL);
- if (aborted != -1)
- vmsg("行事曆更新完畢");
- return 0;
- } else if (genbuf[0] == 'd') {
- sethomefile(genbuf, cuser.userid, "calendar");
- unlink(genbuf);
- vmsg("行事曆刪除完畢");
- } else if (genbuf[0] == 'h') {
- move(1, 0);
- clrtoln(b_lines);
- move(3, 0);
- prints("行事曆格式說明:\n編輯時以一行為單位,如:\n\n# 井號開頭的是註解\n2006/05/04 red 上批踢踢!\n\n其中的 red 是指表示的顏色。");
- pressanykey();
- }
- return 0;
-}
/* 使用者填寫註冊表格 */
static void