/**************************************************
OpengateM - MAC address authentication system
- module for Communication through CGI
+
+ module for construction of multi-language messages
+
+ To enable the 'msgNo' message, call as 'SetMessage(msgNo)'.
+ (The msgNo and message string is in messagesInJa/messagesInEn)
+ To insert enabled messages, call as 'InsertMessageToPage("ja")'.
+ (At '%%ERRORLIST%%' in html template, 'ja' messages are inserted)
+ To disable all messages, call as 'ResetMessage()'.
Copyright (C) 2011 Opengate Project Team
Written by Yoshiaki Watanabe
#include "opengatemmng.h"
-int messageSet[ENDOFLIST]={0};
+int messageSet[ENDOFLIST]={0}; /* to enable a message, set the index true */
-/*******************************
- set message
-*******************************/
+/*******************************/
+/* set message */
+/* enable the 'msgNo' message */
+/*******************************/
void setMessage(int msgNo){
if(msgNo < ENDOFLIST) messageSet[msgNo]=TRUE;
}
-/*******************************
- reset message
-*******************************/
+/*******************************/
+/* reset message */
+/* disable all messages */
+/*******************************/
void resetMessage(void){
int i;
for(i=0;i<ENDOFLIST;i++) messageSet[i]=FALSE;
}
-/*******************************
- insert message in multi-lang to page
-*******************************/
+/****************************************/
+/* insert enables messages into page */
+/* language is 'ja' or 'en' at now. */
+/* if you want to add other languages, */
+/* add messagesIn??, and call form this */
+/****************************************/
void insertMessageToPage(char* language){
char* (*pMessageFunc)(int msgNo);
}
}
-/******************************
- error message in english
-******************************/
+/******************************/
+/* message in english */
+/******************************/
char* messagesInEn(int msgNo){
char* messages[ENDOFLIST];
messages[ExistentMacAddr]="Error: Mac address is already registered. Update it in update page.";
return messages[msgNo];
}
-/******************************
- error message in japanese (utf-8)
-******************************/
+/*************************************/
+/* error message in japanese (utf-8) */
+/*************************************/
char* messagesInJa(int msgNo){
char* messages[ENDOFLIST];
messages[ExistentMacAddr]= "エラー:既登録のMACアドレスです。更新ページで更新してください。";
return messages[msgNo];
}
-/***********************************
-make weekday string for language
-***********************************/
+/************************************/
+/* make weekday string for language */
+/************************************/
char* weekdayStr(int weekday, char* str, char* language){
char* weekdayStrEn[7]={"Mon","Tue","Wed","Thu","Fri","Sat","Sun"};